Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/attachments.php

    r46586 r47122  
    2424    function test_insert_image_no_thumb() {
    2525
    26         // this image is smaller than the thumbnail size so it won't have one
     26        // This image is smaller than the thumbnail size so it won't have one.
    2727        $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    2828        $contents = file_get_contents( $filename );
     
    3333        $id = $this->_make_attachment( $upload );
    3434
    35         // intermediate copies should not exist
     35        // Intermediate copies should not exist.
    3636        $this->assertFalse( image_get_intermediate_size( $id, 'thumbnail' ) );
    3737        $this->assertFalse( image_get_intermediate_size( $id, 'medium' ) );
    3838        $this->assertFalse( image_get_intermediate_size( $id, 'medium_large' ) );
    3939
    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.
    4141        $downsize = image_downsize( $id, 'medium' );
    4242        $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
     
    7272        $id = $this->_make_attachment( $upload );
    7373
    74         // intermediate copies should exist: thumbnail only
     74        // Intermediate copies should exist: thumbnail only.
    7575        $thumb = image_get_intermediate_size( $id, 'thumbnail' );
    7676        $this->assertEquals( 'a2-small-150x150.jpg', $thumb['file'] );
     
    8282        $this->assertFalse( image_get_intermediate_size( $id, 'medium_large' ) );
    8383
    84         // the thumb url should point to the thumbnail intermediate
     84        // The thumb url should point to the thumbnail intermediate.
    8585        $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
    8686
    87         // image_downsize() should return the correct images and sizes
     87        // image_downsize() should return the correct images and sizes.
    8888        $downsize = image_downsize( $id, 'thumbnail' );
    8989        $this->assertEquals( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) );
     
    9191        $this->assertEquals( 150, $downsize[2] );
    9292
    93         // medium, medium_large, and full will both point to the original
     93        // medium, medium_large, and full will both point to the original.
    9494        $downsize = image_downsize( $id, 'medium' );
    9595        $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
     
    129129        $uploads = wp_upload_dir();
    130130
    131         // intermediate copies should exist: thumbnail and medium
     131        // Intermediate copies should exist: thumbnail and medium.
    132132        $thumb = image_get_intermediate_size( $id, 'thumbnail' );
    133133        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
     
    142142        $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) );
    143143
    144         // the thumb url should point to the thumbnail intermediate
     144        // The thumb url should point to the thumbnail intermediate.
    145145        $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
    146146
    147         // image_downsize() should return the correct images and sizes
     147        // image_downsize() should return the correct images and sizes.
    148148        $downsize = image_downsize( $id, 'thumbnail' );
    149149        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );
     
    188188        $uploads = wp_upload_dir();
    189189
    190         // check that the file and intermediates exist
     190        // Check that the file and intermediates exist.
    191191        $thumb = image_get_intermediate_size( $id, 'thumbnail' );
    192192        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
     
    205205        $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $original ) );
    206206
    207         // now delete the attachment and make sure all files are gone
     207        // Now delete the attachment and make sure all files are gone.
    208208        wp_delete_attachment( $id );
    209209
     
    221221     */
    222222    function test_insert_image_without_guid() {
    223         // this image is smaller than the thumbnail size so it won't have one
     223        // This image is smaller than the thumbnail size so it won't have one.
    224224        $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    225225        $contents = file_get_contents( $filename );
     
    273273        $attachment_id = $this->_make_attachment( $upload );
    274274
    275         // Assert that the attachment is an orphan
     275        // Assert that the attachment is an orphan.
    276276        $attachment = get_post( $attachment_id );
    277277        $this->assertEquals( $attachment->post_parent, 0 );
     
    284284        );
    285285
    286         // Assert that the attachment has a parent
     286        // Assert that the attachment has a parent.
    287287        wp_insert_attachment( $attachment, '', $post_id );
    288288        $attachment = get_post( $attachment_id );
     
    353353        $this->assertTrue( empty( $upload['error'] ) );
    354354
    355         // Set attachment ID
     355        // Set attachment ID.
    356356        $attachment_id = $this->_make_attachment( $upload );
    357357
     
    409409        $this->assertTrue( empty( $upload['error'] ) );
    410410
    411         // Set attachment ID
     411        // Set attachment ID.
    412412        $attachment_id = $this->_make_attachment( $upload );
    413413
     
    427427     */
    428428    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.
    430430        add_filter( 'upload_dir', '_upload_dir_https' );
    431431
     
    436436        $this->assertTrue( empty( $upload['error'] ) );
    437437
    438         // Set attachment ID
     438        // Set attachment ID.
    439439        $attachment_id = $this->_make_attachment( $upload );
    440440
Note: See TracChangeset for help on using the changeset viewer.