Changeset 48937 for trunk/tests/phpunit/tests/post/attachments.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/attachments.php
r48190 r48937 40 40 // medium, medium_large, and full size will both point to the original. 41 41 $downsize = image_downsize( $id, 'medium' ); 42 $this->assert Equals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );43 $this->assert Equals( 50, $downsize[1] );44 $this->assert Equals( 50, $downsize[2] );42 $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) ); 43 $this->assertSame( 50, $downsize[1] ); 44 $this->assertSame( 50, $downsize[2] ); 45 45 46 46 $downsize = image_downsize( $id, 'medium_large' ); 47 $this->assert Equals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );48 $this->assert Equals( 50, $downsize[1] );49 $this->assert Equals( 50, $downsize[2] );47 $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) ); 48 $this->assertSame( 50, $downsize[1] ); 49 $this->assertSame( 50, $downsize[2] ); 50 50 51 51 $downsize = image_downsize( $id, 'full' ); 52 $this->assert Equals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );53 $this->assert Equals( 50, $downsize[1] );54 $this->assert Equals( 50, $downsize[2] );52 $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) ); 53 $this->assertSame( 50, $downsize[1] ); 54 $this->assertSame( 50, $downsize[2] ); 55 55 } 56 56 … … 73 73 // Intermediate copies should exist: thumbnail only. 74 74 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 75 $this->assert Equals( 'a2-small-150x150.jpg', $thumb['file'] );75 $this->assertSame( 'a2-small-150x150.jpg', $thumb['file'] ); 76 76 77 77 $uploads = wp_upload_dir(); … … 82 82 83 83 // The thumb url should point to the thumbnail intermediate. 84 $this->assert Equals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );84 $this->assertSame( $thumb['url'], wp_get_attachment_thumb_url( $id ) ); 85 85 86 86 // image_downsize() should return the correct images and sizes. 87 87 $downsize = image_downsize( $id, 'thumbnail' ); 88 $this->assert Equals( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) );89 $this->assert Equals( 150, $downsize[1] );90 $this->assert Equals( 150, $downsize[2] );88 $this->assertSame( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) ); 89 $this->assertSame( 150, $downsize[1] ); 90 $this->assertSame( 150, $downsize[2] ); 91 91 92 92 // medium, medium_large, and full will both point to the original. 93 93 $downsize = image_downsize( $id, 'medium' ); 94 $this->assert Equals( 'a2-small.jpg', wp_basename( $downsize[0] ) );95 $this->assert Equals( 400, $downsize[1] );96 $this->assert Equals( 300, $downsize[2] );94 $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) ); 95 $this->assertSame( 400, $downsize[1] ); 96 $this->assertSame( 300, $downsize[2] ); 97 97 98 98 $downsize = image_downsize( $id, 'medium_large' ); 99 $this->assert Equals( 'a2-small.jpg', wp_basename( $downsize[0] ) );100 $this->assert Equals( 400, $downsize[1] );101 $this->assert Equals( 300, $downsize[2] );99 $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) ); 100 $this->assertSame( 400, $downsize[1] ); 101 $this->assertSame( 300, $downsize[2] ); 102 102 103 103 $downsize = image_downsize( $id, 'full' ); 104 $this->assert Equals( 'a2-small.jpg', wp_basename( $downsize[0] ) );105 $this->assert Equals( 400, $downsize[1] );106 $this->assert Equals( 300, $downsize[2] );104 $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) ); 105 $this->assertSame( 400, $downsize[1] ); 106 $this->assertSame( 300, $downsize[2] ); 107 107 } 108 108 … … 129 129 // Intermediate copies should exist: thumbnail and medium. 130 130 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 131 $this->assert Equals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );131 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); 132 132 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); 133 133 134 134 $medium = image_get_intermediate_size( $id, 'medium' ); 135 $this->assert Equals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );135 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 136 136 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) ); 137 137 138 138 $medium_large = image_get_intermediate_size( $id, 'medium_large' ); 139 $this->assert Equals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );139 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] ); 140 140 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); 141 141 142 142 // The thumb url should point to the thumbnail intermediate. 143 $this->assert Equals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );143 $this->assertSame( $thumb['url'], wp_get_attachment_thumb_url( $id ) ); 144 144 145 145 // image_downsize() should return the correct images and sizes. 146 146 $downsize = image_downsize( $id, 'thumbnail' ); 147 $this->assert Equals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );148 $this->assert Equals( 150, $downsize[1] );149 $this->assert Equals( 150, $downsize[2] );147 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) ); 148 $this->assertSame( 150, $downsize[1] ); 149 $this->assertSame( 150, $downsize[2] ); 150 150 151 151 $downsize = image_downsize( $id, 'medium' ); 152 $this->assert Equals( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) );153 $this->assert Equals( 400, $downsize[1] );154 $this->assert Equals( 602, $downsize[2] );152 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) ); 153 $this->assertSame( 400, $downsize[1] ); 154 $this->assertSame( 602, $downsize[2] ); 155 155 156 156 $downsize = image_downsize( $id, 'medium_large' ); 157 $this->assert Equals( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) );158 $this->assert Equals( 600, $downsize[1] );159 $this->assert Equals( 904, $downsize[2] );157 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) ); 158 $this->assertSame( 600, $downsize[1] ); 159 $this->assertSame( 904, $downsize[2] ); 160 160 161 161 $downsize = image_downsize( $id, 'full' ); 162 $this->assert Equals( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) );163 $this->assert Equals( 680, $downsize[1] );164 $this->assert Equals( 1024, $downsize[2] );162 $this->assertSame( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) ); 163 $this->assertSame( 680, $downsize[1] ); 164 $this->assertSame( 1024, $downsize[2] ); 165 165 } 166 166 … … 188 188 // Check that the file and intermediates exist. 189 189 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 190 $this->assert Equals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );190 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); 191 191 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); 192 192 193 193 $medium = image_get_intermediate_size( $id, 'medium' ); 194 $this->assert Equals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );194 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 195 195 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) ); 196 196 197 197 $medium_large = image_get_intermediate_size( $id, 'medium_large' ); 198 $this->assert Equals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );198 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] ); 199 199 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); 200 200 … … 256 256 257 257 // Make sure the update didn't remove the attached file. 258 $this->assert Equals( $attached_file, get_post_meta( $id, '_wp_attached_file', true ) );258 $this->assertSame( $attached_file, get_post_meta( $id, '_wp_attached_file', true ) ); 259 259 } 260 260 … … 273 273 // Assert that the attachment is an orphan. 274 274 $attachment = get_post( $attachment_id ); 275 $this->assert Equals( $attachment->post_parent, 0 );275 $this->assertSame( $attachment->post_parent, 0 ); 276 276 277 277 $post_id = wp_insert_post( … … 285 285 wp_insert_attachment( $attachment, '', $post_id ); 286 286 $attachment = get_post( $attachment_id ); 287 $this->assert Equals( $attachment->post_parent, $post_id );287 $this->assertSame( $attachment->post_parent, $post_id ); 288 288 } 289 289
Note: See TracChangeset
for help on using the changeset viewer.