Changeset 47122 for trunk/tests/phpunit/tests/post/attachments.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/attachments.php
r46586 r47122 24 24 function test_insert_image_no_thumb() { 25 25 26 // this image is smaller than the thumbnail size so it won't have one26 // This image is smaller than the thumbnail size so it won't have one. 27 27 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 28 28 $contents = file_get_contents( $filename ); … … 33 33 $id = $this->_make_attachment( $upload ); 34 34 35 // intermediate copies should not exist35 // Intermediate copies should not exist. 36 36 $this->assertFalse( image_get_intermediate_size( $id, 'thumbnail' ) ); 37 37 $this->assertFalse( image_get_intermediate_size( $id, 'medium' ) ); 38 38 $this->assertFalse( image_get_intermediate_size( $id, 'medium_large' ) ); 39 39 40 // medium, medium_large, and full size will both point to the original 40 // medium, medium_large, and full size will both point to the original. 41 41 $downsize = image_downsize( $id, 'medium' ); 42 42 $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) ); … … 72 72 $id = $this->_make_attachment( $upload ); 73 73 74 // intermediate copies should exist: thumbnail only74 // Intermediate copies should exist: thumbnail only. 75 75 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 76 76 $this->assertEquals( 'a2-small-150x150.jpg', $thumb['file'] ); … … 82 82 $this->assertFalse( image_get_intermediate_size( $id, 'medium_large' ) ); 83 83 84 // the thumb url should point to the thumbnail intermediate84 // The thumb url should point to the thumbnail intermediate. 85 85 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) ); 86 86 87 // image_downsize() should return the correct images and sizes 87 // image_downsize() should return the correct images and sizes. 88 88 $downsize = image_downsize( $id, 'thumbnail' ); 89 89 $this->assertEquals( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) ); … … 91 91 $this->assertEquals( 150, $downsize[2] ); 92 92 93 // medium, medium_large, and full will both point to the original 93 // medium, medium_large, and full will both point to the original. 94 94 $downsize = image_downsize( $id, 'medium' ); 95 95 $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) ); … … 129 129 $uploads = wp_upload_dir(); 130 130 131 // intermediate copies should exist: thumbnail and medium131 // Intermediate copies should exist: thumbnail and medium. 132 132 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 133 133 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); … … 142 142 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); 143 143 144 // the thumb url should point to the thumbnail intermediate144 // The thumb url should point to the thumbnail intermediate. 145 145 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) ); 146 146 147 // image_downsize() should return the correct images and sizes 147 // image_downsize() should return the correct images and sizes. 148 148 $downsize = image_downsize( $id, 'thumbnail' ); 149 149 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) ); … … 188 188 $uploads = wp_upload_dir(); 189 189 190 // check that the file and intermediates exist190 // Check that the file and intermediates exist. 191 191 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 192 192 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); … … 205 205 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $original ) ); 206 206 207 // now delete the attachment and make sure all files are gone207 // Now delete the attachment and make sure all files are gone. 208 208 wp_delete_attachment( $id ); 209 209 … … 221 221 */ 222 222 function test_insert_image_without_guid() { 223 // this image is smaller than the thumbnail size so it won't have one223 // This image is smaller than the thumbnail size so it won't have one. 224 224 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 225 225 $contents = file_get_contents( $filename ); … … 273 273 $attachment_id = $this->_make_attachment( $upload ); 274 274 275 // Assert that the attachment is an orphan 275 // Assert that the attachment is an orphan. 276 276 $attachment = get_post( $attachment_id ); 277 277 $this->assertEquals( $attachment->post_parent, 0 ); … … 284 284 ); 285 285 286 // Assert that the attachment has a parent 286 // Assert that the attachment has a parent. 287 287 wp_insert_attachment( $attachment, '', $post_id ); 288 288 $attachment = get_post( $attachment_id ); … … 353 353 $this->assertTrue( empty( $upload['error'] ) ); 354 354 355 // Set attachment ID 355 // Set attachment ID. 356 356 $attachment_id = $this->_make_attachment( $upload ); 357 357 … … 409 409 $this->assertTrue( empty( $upload['error'] ) ); 410 410 411 // Set attachment ID 411 // Set attachment ID. 412 412 $attachment_id = $this->_make_attachment( $upload ); 413 413 … … 427 427 */ 428 428 public function test_wp_get_attachment_url_should_force_https_when_administering_over_https_and_siteurl_is_https() { 429 // Set https upload URL 429 // Set https upload URL. 430 430 add_filter( 'upload_dir', '_upload_dir_https' ); 431 431 … … 436 436 $this->assertTrue( empty( $upload['error'] ) ); 437 437 438 // Set attachment ID 438 // Set attachment ID. 439 439 $attachment_id = $this->_make_attachment( $upload ); 440 440
Note: See TracChangeset
for help on using the changeset viewer.