Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r51816 r52010  
    5757    }
    5858
    59     function set_up() {
     59    public function set_up() {
    6060        parent::set_up();
    6161        $this->caption           = 'A simple caption.';
     
    7777    }
    7878
    79     function test_img_caption_shortcode_added() {
     79    public function test_img_caption_shortcode_added() {
    8080        global $shortcode_tags;
    8181        $this->assertSame( 'img_caption_shortcode', $shortcode_tags['caption'] );
     
    8383    }
    8484
    85     function test_img_caption_shortcode_with_empty_params() {
     85    public function test_img_caption_shortcode_with_empty_params() {
    8686        $result = img_caption_shortcode( array() );
    8787        $this->assertSame( '', $result );
     
    9191     * @ticket 33981
    9292     */
    93     function test_img_caption_shortcode_with_empty_params_but_content() {
     93    public function test_img_caption_shortcode_with_empty_params_but_content() {
    9494        $result = img_caption_shortcode( array(), $this->caption );
    9595        $this->assertSame( $this->caption, $result );
     
    9999     * @ticket 33981
    100100     */
    101     function test_img_caption_shortcode_short_circuit_filter() {
    102         add_filter( 'img_caption_shortcode', array( $this, '_return_alt_caption' ) );
     101    public function test_img_caption_shortcode_short_circuit_filter() {
     102        add_filter( 'img_caption_shortcode', array( $this, 'return_alt_caption' ) );
    103103
    104104        $result = img_caption_shortcode( array(), $this->caption );
     
    109109     * Filter used in test_img_caption_shortcode_short_circuit_filter()
    110110     */
    111     function _return_alt_caption() {
     111    public function return_alt_caption() {
    112112        return $this->alternate_caption;
    113113    }
     
    116116     * @ticket 33981
    117117     */
    118     function test_img_caption_shortcode_empty_width() {
     118    public function test_img_caption_shortcode_empty_width() {
    119119        $result = img_caption_shortcode(
    120120            array(
     
    129129     * @ticket 33981
    130130     */
    131     function test_img_caption_shortcode_empty_caption() {
     131    public function test_img_caption_shortcode_empty_caption() {
    132132        $result = img_caption_shortcode(
    133133            array(
     
    141141     * @ticket 33981
    142142     */
    143     function test_img_caption_shortcode_empty_caption_and_content() {
     143    public function test_img_caption_shortcode_empty_caption_and_content() {
    144144        $result = img_caption_shortcode(
    145145            array(
     
    151151    }
    152152
    153     function test_img_caption_shortcode_with_old_format() {
     153    public function test_img_caption_shortcode_with_old_format() {
    154154        $result = img_caption_shortcode(
    155155            array(
     
    170170    }
    171171
    172     function test_img_caption_shortcode_with_old_format_id_and_align() {
     172    public function test_img_caption_shortcode_with_old_format_id_and_align() {
    173173        $result = img_caption_shortcode(
    174174            array(
     
    184184    }
    185185
    186     function test_img_caption_shortcode_with_old_format_and_class() {
     186    public function test_img_caption_shortcode_with_old_format_and_class() {
    187187        $result = img_caption_shortcode(
    188188            array(
     
    196196    }
    197197
    198     function test_new_img_caption_shortcode_with_html_caption() {
     198    public function test_new_img_caption_shortcode_with_html_caption() {
    199199        $result   = img_caption_shortcode(
    200200            array(
     
    208208    }
    209209
    210     function test_new_img_caption_shortcode_new_format() {
     210    public function test_new_img_caption_shortcode_new_format() {
    211211        $result       = img_caption_shortcode(
    212212            array( 'width' => 20 ),
     
    220220    }
    221221
    222     function test_new_img_caption_shortcode_new_format_and_linked_image() {
     222    public function test_new_img_caption_shortcode_new_format_and_linked_image() {
    223223        $linked_image = "<a href='#'>{$this->img_content}</a>";
    224224        $result       = img_caption_shortcode(
     
    233233    }
    234234
    235     function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
     235    public function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
    236236        $linked_image = "<a href='#'>{$this->img_content}</a>";
    237237        $result       = img_caption_shortcode(
     
    249249     * @ticket 34595
    250250     */
    251     function test_img_caption_shortcode_has_aria_describedby() {
     251    public function test_img_caption_shortcode_has_aria_describedby() {
    252252        $result = img_caption_shortcode(
    253253            array(
     
    261261    }
    262262
    263     function test_add_remove_oembed_provider() {
     263    public function test_add_remove_oembed_provider() {
    264264        wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' );
    265265        $this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
     
    270270     * @ticket 23776
    271271     */
    272     function test_autoembed_empty() {
     272    public function test_autoembed_empty() {
    273273        global $wp_embed;
    274274
     
    284284     * @group external-http
    285285     */
    286     function test_autoembed_no_paragraphs_around_urls() {
     286    public function test_autoembed_no_paragraphs_around_urls() {
    287287        global $wp_embed;
    288288
     
    303303    }
    304304
    305     function data_autoembed() {
     305    public function data_autoembed() {
    306306        return array(
    307307
     
    363363     * @dataProvider data_autoembed
    364364     */
    365     function test_autoembed( $content, $result = null ) {
     365    public function test_autoembed( $content, $result = null ) {
    366366        $wp_embed = new Test_Autoembed;
    367367
     
    369369    }
    370370
    371     function test_wp_prepare_attachment_for_js() {
     371    public function test_wp_prepare_attachment_for_js() {
    372372        // Attachment without media.
    373373        $id   = wp_insert_attachment(
     
    423423     * @ticket 38965
    424424     */
    425     function test_wp_prepare_attachment_for_js_without_image_sizes() {
     425    public function test_wp_prepare_attachment_for_js_without_image_sizes() {
    426426        // Create the attachement post.
    427427        $id = wp_insert_attachment(
     
    454454     * @expectedDeprecated wp_convert_bytes_to_hr
    455455     */
    456     function test_wp_convert_bytes_to_hr() {
     456    public function test_wp_convert_bytes_to_hr() {
    457457        $kb = 1024;
    458458        $mb = $kb * 1024;
     
    492492     * @ticket 22960
    493493     */
    494     function test_get_attached_images() {
     494    public function test_get_attached_images() {
    495495        $post_id       = self::factory()->post->create();
    496496        $attachment_id = self::factory()->attachment->create_object(
     
    510510     * @ticket 22960
    511511     */
    512     function test_post_galleries_images() {
     512    public function test_post_galleries_images() {
    513513        $ids1      = array();
    514514        $ids1_srcs = array();
     
    561561     * @ticket 39304
    562562     */
    563     function test_post_galleries_images_without_global_post() {
     563    public function test_post_galleries_images_without_global_post() {
    564564        // Set up an unattached image.
    565565        $this->factory->attachment->create_object(
     
    586586     * @ticket 39304
    587587     */
    588     function test_post_galleries_ignores_global_post() {
     588    public function test_post_galleries_ignores_global_post() {
    589589        $global_post_id = $this->factory->post->create(
    590590            array(
     
    621621     * @ticket 39304
    622622     */
    623     function test_post_galleries_respects_id_attrs() {
     623    public function test_post_galleries_respects_id_attrs() {
    624624        $post_id     = $this->factory->post->create(
    625625            array(
     
    660660     * @ticket 22960
    661661     */
    662     function test_post_gallery_images() {
     662    public function test_post_gallery_images() {
    663663        $ids1      = array();
    664664        $ids1_srcs = array();
     
    708708    }
    709709
    710     function test_get_media_embedded_in_content() {
     710    public function test_get_media_embedded_in_content() {
    711711        $object = <<<OBJ
    712712<object src="this" data="that">
     
    772772    }
    773773
    774     function test_get_media_embedded_in_content_order() {
     774    public function test_get_media_embedded_in_content_order() {
    775775        $audio   = <<<AUDIO
    776776<audio preload="none">
     
    796796     * @ticket 35367
    797797     */
    798     function test_wp_audio_shortcode_with_empty_params() {
     798    public function test_wp_audio_shortcode_with_empty_params() {
    799799        $this->assertNull( wp_audio_shortcode( array() ) );
    800800    }
     
    803803     * @ticket 35367
    804804     */
    805     function test_wp_audio_shortcode_with_bad_attr() {
     805    public function test_wp_audio_shortcode_with_bad_attr() {
    806806        $this->assertSame(
    807807            '<a class="wp-embedded-audio" href="https://example.com/foo.php">https://example.com/foo.php</a>',
     
    817817     * @ticket 35367
    818818     */
    819     function test_wp_audio_shortcode_attributes() {
     819    public function test_wp_audio_shortcode_attributes() {
    820820        $actual = wp_audio_shortcode(
    821821            array(
     
    853853     * Test [video] shortcode processing
    854854     */
    855     function test_video_shortcode_body() {
     855    public function test_video_shortcode_body() {
    856856        $width  = 720;
    857857        $height = 480;
     
    899899     * @depends test_video_shortcode_body
    900900     */
    901     function test_wp_video_shortcode_with_empty_params() {
     901    public function test_wp_video_shortcode_with_empty_params() {
    902902        $this->assertNull( wp_video_shortcode( array() ) );
    903903    }
     
    907907     * @depends test_video_shortcode_body
    908908     */
    909     function test_wp_video_shortcode_with_bad_attr() {
     909    public function test_wp_video_shortcode_with_bad_attr() {
    910910        $this->assertSame(
    911911            '<a class="wp-embedded-video" href="https://example.com/foo.php">https://example.com/foo.php</a>',
     
    922922     * @depends test_video_shortcode_body
    923923     */
    924     function test_wp_video_shortcode_attributes() {
     924    public function test_wp_video_shortcode_attributes() {
    925925        $actual = wp_video_shortcode(
    926926            array(
     
    964964     * @depends test_video_shortcode_body
    965965     */
    966     function test_wp_video_shortcode_youtube_remove_feature() {
     966    public function test_wp_video_shortcode_youtube_remove_feature() {
    967967        $actual = wp_video_shortcode(
    968968            array(
     
    978978     * @depends test_video_shortcode_body
    979979     */
    980     function test_wp_video_shortcode_youtube_force_ssl() {
     980    public function test_wp_video_shortcode_youtube_force_ssl() {
    981981        $actual = wp_video_shortcode(
    982982            array(
     
    992992     * @depends test_video_shortcode_body
    993993     */
    994     function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() {
     994    public function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() {
    995995        $actual = wp_video_shortcode(
    996996            array(
     
    10071007     * @depends test_video_shortcode_body
    10081008     */
    1009     function test_wp_video_shortcode_vimeo_adds_loop() {
     1009    public function test_wp_video_shortcode_vimeo_adds_loop() {
    10101010        $actual = wp_video_shortcode(
    10111011            array(
     
    10211021     * @depends test_video_shortcode_body
    10221022     */
    1023     function test_wp_video_shortcode_vimeo_force_adds_loop_true() {
     1023    public function test_wp_video_shortcode_vimeo_force_adds_loop_true() {
    10241024        $actual = wp_video_shortcode(
    10251025            array(
     
    10351035     * @ticket 26768
    10361036     */
    1037     function test_add_image_size() {
     1037    public function test_add_image_size() {
    10381038        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    10391039
     
    10561056     * @ticket 26768
    10571057     */
    1058     function test_remove_image_size() {
     1058    public function test_remove_image_size() {
    10591059        add_image_size( 'test-size', 200, 600 );
    10601060        $this->assertTrue( has_image_size( 'test-size' ) );
     
    10661066     * @ticket 26951
    10671067     */
    1068     function test_has_image_size() {
     1068    public function test_has_image_size() {
    10691069        add_image_size( 'test-size', 200, 600 );
    10701070        $this->assertTrue( has_image_size( 'test-size' ) );
     
    10771077     * @ticket 30346
    10781078     */
    1079     function test_attachment_url_to_postid() {
     1079    public function test_attachment_url_to_postid() {
    10801080        $image_path    = '2014/11/' . $this->img_name;
    10811081        $attachment_id = self::factory()->attachment->create_object(
     
    10951095     * @ticket 33109
    10961096     */
    1097     function test_attachment_url_to_postid_with_different_scheme() {
     1097    public function test_attachment_url_to_postid_with_different_scheme() {
    10981098        $image_path    = '2014/11/' . $this->img_name;
    10991099        $attachment_id = self::factory()->attachment->create_object(
     
    11131113     * @ticket 39768
    11141114     */
    1115     function test_attachment_url_to_postid_should_be_case_sensitive() {
     1115    public function test_attachment_url_to_postid_should_be_case_sensitive() {
    11161116        $image_path_lower_case    = '2014/11/' . $this->img_name;
    11171117        $attachment_id_lower_case = self::factory()->attachment->create_object(
     
    11381138    }
    11391139
    1140     function test_attachment_url_to_postid_filtered() {
     1140    public function test_attachment_url_to_postid_filtered() {
    11411141        $image_path    = '2014/11/' . $this->img_name;
    11421142        $attachment_id = self::factory()->attachment->create_object(
     
    11491149        );
    11501150
    1151         add_filter( 'upload_dir', array( $this, '_upload_dir' ) );
     1151        add_filter( 'upload_dir', array( $this, 'upload_dir' ) );
    11521152        $image_url = 'http://192.168.1.20.com/wp-content/uploads/' . $image_path;
    11531153        $this->assertSame( $attachment_id, attachment_url_to_postid( $image_url ) );
    1154         remove_filter( 'upload_dir', array( $this, '_upload_dir' ) );
    1155     }
    1156 
    1157     function _upload_dir( $dir ) {
     1154        remove_filter( 'upload_dir', array( $this, 'upload_dir' ) );
     1155    }
     1156
     1157    public function upload_dir( $dir ) {
    11581158        $dir['baseurl'] = 'http://192.168.1.20.com/wp-content/uploads';
    11591159        return $dir;
     
    11631163     * @ticket 31044
    11641164     */
    1165     function test_attachment_url_to_postid_with_empty_url() {
     1165    public function test_attachment_url_to_postid_with_empty_url() {
    11661166        $post_id = attachment_url_to_postid( '' );
    11671167        $this->assertIsInt( $post_id );
     
    12501250     * @ticket 33016
    12511251     */
    1252     function test_multiline_cdata() {
     1252    public function test_multiline_cdata() {
    12531253        global $wp_embed;
    12541254
     
    12671267     * @ticket 33016
    12681268     */
    1269     function test_multiline_comment() {
     1269    public function test_multiline_comment() {
    12701270        global $wp_embed;
    12711271
     
    12861286     * @group external-http
    12871287     */
    1288     function test_multiline_comment_with_embeds() {
     1288    public function test_multiline_comment_with_embeds() {
    12891289        $content = <<<EOF
    12901290Start.
     
    13191319     * @ticket 33016
    13201320     */
    1321     function filter_wp_embed_shortcode_custom( $content, $url ) {
     1321    public function filter_wp_embed_shortcode_custom( $content, $url ) {
    13221322        if ( 'https://www.example.com/?video=1' === $url ) {
    13231323            $content = '@embed URL was replaced@';
     
    13311331     * @group external-http
    13321332     */
    1333     function test_oembed_explicit_media_link() {
     1333    public function test_oembed_explicit_media_link() {
    13341334        global $wp_embed;
    13351335        add_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10, 2 );
     
    13681368     * @ticket 34635
    13691369     */
    1370     function test_wp_get_attachment_image_defaults() {
     1370    public function test_wp_get_attachment_image_defaults() {
    13711371        $image    = image_downsize( self::$large_id, 'thumbnail' );
    13721372        $expected = sprintf(
     
    13831383     * @ticket 50801
    13841384     */
    1385     function test_wp_get_attachment_image_filter_output() {
     1385    public function test_wp_get_attachment_image_filter_output() {
    13861386        $image    = image_downsize( self::$large_id, 'thumbnail' );
    13871387        $expected = 'Override wp_get_attachment_image';
     
    13941394    }
    13951395
    1396     function filter_wp_get_attachment_image() {
     1396    public function filter_wp_get_attachment_image() {
    13971397        return 'Override wp_get_attachment_image';
    13981398    }
     
    14031403     * @ticket 34635
    14041404     */
    1405     function test_wp_get_attachment_image_with_alt() {
     1405    public function test_wp_get_attachment_image_with_alt() {
    14061406        // Add test alt metadata.
    14071407        update_post_meta( self::$large_id, '_wp_attachment_image_alt', 'Some very clever alt text', true );
     
    14241424     * @ticket 33878
    14251425     */
    1426     function test_wp_get_attachment_image_url() {
     1426    public function test_wp_get_attachment_image_url() {
    14271427        $this->assertFalse( wp_get_attachment_image_url( 0 ) );
    14281428
     
    14451445     * @ticket 12235
    14461446     */
    1447     function test_wp_get_attachment_caption() {
     1447    public function test_wp_get_attachment_caption() {
    14481448        $this->assertFalse( wp_get_attachment_caption( 0 ) );
    14491449
     
    14691469     * @ticket 12235
    14701470     */
    1471     function test_wp_get_attachment_caption_empty() {
     1471    public function test_wp_get_attachment_caption_empty() {
    14721472        $post_id       = self::factory()->post->create();
    14731473        $attachment_id = self::factory()->attachment->create_object(
     
    14871487     * Helper function to get image size array from size "name".
    14881488     */
    1489     function _get_image_size_array_from_meta( $image_meta, $size_name ) {
     1489    private function get_image_size_array_from_meta( $image_meta, $size_name ) {
    14901490        $array = false;
    14911491
     
    15081508     * Helper function to move the src image to the first position in the expected srcset string.
    15091509     */
    1510     function _src_first( $srcset, $src_url, $src_width ) {
     1510    private function src_first( $srcset, $src_url, $src_width ) {
    15111511        $src_string    = $src_url . ' ' . $src_width . 'w';
    15121512        $src_not_first = ', ' . $src_string;
     
    15241524     * @requires function imagejpeg
    15251525     */
    1526     function test_wp_calculate_image_srcset() {
     1526    public function test_wp_calculate_image_srcset() {
    15271527        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    15281528
     
    15541554        foreach ( $intermediates as $int ) {
    15551555            $image_url  = wp_get_attachment_image_url( self::$large_id, $int );
    1556             $size_array = $this->_get_image_size_array_from_meta( $image_meta, $int );
     1556            $size_array = $this->get_image_size_array_from_meta( $image_meta, $int );
    15571557
    15581558            if ( 'full' === $int ) {
     
    15631563            }
    15641564
    1565             $expected_srcset = $this->_src_first( $_expected, $image_url, $size_array[0] );
     1565            $expected_srcset = $this->src_first( $_expected, $image_url, $size_array[0] );
    15661566            $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) );
    15671567        }
     
    15721572     * @requires function imagejpeg
    15731573     */
    1574     function test_wp_calculate_image_srcset_no_date_uploads() {
     1574    public function test_wp_calculate_image_srcset_no_date_uploads() {
    15751575        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    15761576
     
    16061606
    16071607        foreach ( $intermediates as $int ) {
    1608             $size_array = $this->_get_image_size_array_from_meta( $image_meta, $int );
     1608            $size_array = $this->get_image_size_array_from_meta( $image_meta, $int );
    16091609            $image_url  = wp_get_attachment_image_url( $id, $int );
    16101610
     
    16161616            }
    16171617
    1618             $expected_srcset = $this->_src_first( $_expected, $image_url, $size_array[0] );
     1618            $expected_srcset = $this->src_first( $_expected, $image_url, $size_array[0] );
    16191619            $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) );
    16201620        }
     
    16291629     * @requires function imagejpeg
    16301630     */
    1631     function test_wp_calculate_image_srcset_with_edits() {
     1631    public function test_wp_calculate_image_srcset_with_edits() {
    16321632        // For this test we're going to mock metadata changes from an edit.
    16331633        // Start by getting the attachment metadata.
    16341634        $image_meta = wp_get_attachment_metadata( self::$large_id );
    16351635        $image_url  = wp_get_attachment_image_url( self::$large_id, 'medium' );
    1636         $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
     1636        $size_array = $this->get_image_size_array_from_meta( $image_meta, 'medium' );
    16371637
    16381638        // Copy hash generation method used in wp_save_image().
     
    16631663     * @requires function imagejpeg
    16641664     */
    1665     function test_wp_calculate_image_srcset_with_absolute_path_in_meta() {
     1665    public function test_wp_calculate_image_srcset_with_absolute_path_in_meta() {
    16661666        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    16671667
     
    16971697        foreach ( $intermediates as $int ) {
    16981698            $image_url  = wp_get_attachment_image_url( self::$large_id, $int );
    1699             $size_array = $this->_get_image_size_array_from_meta( $image_meta, $int );
     1699            $size_array = $this->get_image_size_array_from_meta( $image_meta, $int );
    17001700
    17011701            if ( 'full' === $int ) {
     
    17061706            }
    17071707
    1708             $expected_srcset = $this->_src_first( $_expected, $image_url, $size_array[0] );
     1708            $expected_srcset = $this->src_first( $_expected, $image_url, $size_array[0] );
    17091709            $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) );
    17101710        }
     
    17141714     * @ticket 33641
    17151715     */
    1716     function test_wp_calculate_image_srcset_false() {
     1716    public function test_wp_calculate_image_srcset_false() {
    17171717        $sizes = wp_calculate_image_srcset( array( 400, 300 ), 'file.png', array() );
    17181718
     
    17251725     * @requires function imagejpeg
    17261726     */
    1727     function test_wp_calculate_image_srcset_no_width() {
     1727    public function test_wp_calculate_image_srcset_no_width() {
    17281728        $file       = get_attached_file( self::$large_id );
    17291729        $image_url  = wp_get_attachment_image_url( self::$large_id, 'medium' );
     
    17421742     * @ticket 33641
    17431743     */
    1744     function test_wp_calculate_image_srcset_ratio_variance() {
     1744    public function test_wp_calculate_image_srcset_ratio_variance() {
    17451745        // Mock data for this test.
    17461746        $size_array = array( 218, 300 );
     
    17911791     * @ticket 33641
    17921792     */
    1793     function test_wp_calculate_image_srcset_include_src() {
     1793    public function test_wp_calculate_image_srcset_include_src() {
    17941794        // Mock data for this test.
    17951795        $size_array = array( 2000, 1000 );
     
    18401840     * @ticket 35480
    18411841     */
    1842     function test_wp_calculate_image_srcset_corrupted_image_meta() {
     1842    public function test_wp_calculate_image_srcset_corrupted_image_meta() {
    18431843        $size_array = array( 300, 150 );
    18441844        $image_src  = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test-300x150.png';
     
    19141914     * @ticket 33641
    19151915     */
    1916     function test_wp_calculate_image_srcset_with_spaces_in_filenames() {
     1916    public function test_wp_calculate_image_srcset_with_spaces_in_filenames() {
    19171917        // Mock data for this test.
    19181918        $image_src  = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test image-300x150.png';
     
    19621962     * @requires function imagejpeg
    19631963     */
    1964     function test_wp_get_attachment_image_srcset() {
     1964    public function test_wp_get_attachment_image_srcset() {
    19651965        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    19661966
     
    19931993        $expected .= $uploads_dir . $image_meta['file'] . ' ' . $image_meta['width'] . 'w';
    19941994
    1995         $expected_srcset = $this->_src_first( $expected, $uploads_dir . $image_meta['file'], $size_array[0] );
     1995        $expected_srcset = $this->src_first( $expected, $uploads_dir . $image_meta['file'], $size_array[0] );
    19961996
    19971997        $this->assertSame( $expected_srcset, $srcset );
     
    20012001     * @ticket 33641
    20022002     */
    2003     function test_wp_get_attachment_image_srcset_single_srcset() {
     2003    public function test_wp_get_attachment_image_srcset_single_srcset() {
    20042004        $image_meta = wp_get_attachment_metadata( self::$large_id );
    20052005        $size_array = array( 150, 150 );
     
    20162016     * @ticket 33641
    20172017     */
    2018     function test_wp_get_attachment_image_srcset_invalidsize() {
     2018    public function test_wp_get_attachment_image_srcset_invalidsize() {
    20192019        $image_meta    = wp_get_attachment_metadata( self::$large_id );
    20202020        $invalid_size  = 'nailthumb';
     
    20322032     * @ticket 33641
    20332033     */
    2034     function test_wp_get_attachment_image_sizes() {
     2034    public function test_wp_get_attachment_image_sizes() {
    20352035        // Test sizes against the default WP sizes.
    20362036        $intermediates = array( 'thumbnail', 'medium', 'medium_large', 'large' );
     
    20532053     * @requires function imagejpeg
    20542054     */
    2055     function test_wp_calculate_image_sizes() {
     2055    public function test_wp_calculate_image_sizes() {
    20562056        // Test sizes against the default WP sizes.
    20572057        $intermediates = array( 'thumbnail', 'medium', 'medium_large', 'large' );
     
    20622062
    20632063        foreach ( $intermediates as $int_size ) {
    2064             $size_array             = $this->_get_image_size_array_from_meta( $image_meta, $int_size );
     2064            $size_array             = $this->get_image_size_array_from_meta( $image_meta, $int_size );
    20652065            $image_src              = $image_meta['sizes'][ $int_size ]['file'];
    20662066            list( $width, $height ) = $size_array;
     
    20772077     * @requires function imagejpeg
    20782078     */
    2079     function test_wp_filter_content_tags_srcset_sizes() {
     2079    public function test_wp_filter_content_tags_srcset_sizes() {
    20802080        $image_meta = wp_get_attachment_metadata( self::$large_id );
    2081         $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
     2081        $size_array = $this->get_image_size_array_from_meta( $image_meta, 'medium' );
    20822082
    20832083        $srcset = sprintf( 'srcset="%s"', wp_get_attachment_image_srcset( self::$large_id, $size_array, $image_meta ) );
     
    21672167     * @ticket 33641
    21682168     */
    2169     function test_wp_filter_content_tags_srcset_sizes_wrong() {
     2169    public function test_wp_filter_content_tags_srcset_sizes_wrong() {
    21702170        $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
    21712171        $img = wp_img_tag_add_loading_attr( $img, 'test' );
     
    21802180     * @ticket 33641
    21812181     */
    2182     function test_wp_filter_content_tags_srcset_sizes_with_preexisting_srcset() {
     2182    public function test_wp_filter_content_tags_srcset_sizes_with_preexisting_srcset() {
    21832183        // Generate HTML and add a dummy srcset attribute.
    21842184        $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    21942194     * @ticket 34528
    21952195     */
    2196     function test_wp_calculate_image_srcset_animated_gifs() {
     2196    public function test_wp_calculate_image_srcset_animated_gifs() {
    21972197        // Mock meta for an animated gif.
    21982198        $image_meta = array(
     
    22392239     * @requires function imagejpeg
    22402240     */
    2241     function test_wp_filter_content_tags_schemes() {
     2241    public function test_wp_filter_content_tags_schemes() {
    22422242        $image_meta = wp_get_attachment_metadata( self::$large_id );
    2243         $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
     2243        $size_array = $this->get_image_size_array_from_meta( $image_meta, 'medium' );
    22442244
    22452245        $srcset = sprintf( 'srcset="%s"', wp_get_attachment_image_srcset( self::$large_id, $size_array, $image_meta ) );
     
    22902290     * @ticket 33641
    22912291     */
    2292     function test_wp_get_attachment_image_with_https_on() {
     2292    public function test_wp_get_attachment_image_with_https_on() {
    22932293        // Mock meta for the image.
    22942294        $image_meta = array(
     
    23352335     * @ticket 36084
    23362336     */
    2337     function test_get_image_send_to_editor_defaults() {
     2337    public function test_get_image_send_to_editor_defaults() {
    23382338        $id      = self::$large_id;
    23392339        $caption = '';
     
    23552355     * @ticket 36084
    23562356     */
    2357     function test_get_image_send_to_editor_defaults_with_optional_params() {
     2357    public function test_get_image_send_to_editor_defaults_with_optional_params() {
    23582358        $id      = self::$large_id;
    23592359        $caption = 'A test caption.';
     
    23792379     * @ticket 36084
    23802380     */
    2381     function test_get_image_send_to_editor_defaults_no_caption_no_rel() {
     2381    public function test_get_image_send_to_editor_defaults_no_caption_no_rel() {
    23822382        $id      = self::$large_id;
    23832383        $caption = '';
     
    24112411     * @requires function imagejpeg
    24122412     */
    2413     function test_wp_get_attachment_image_should_use_wp_get_attachment_metadata() {
    2414         add_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ), 10, 2 );
     2413    public function test_wp_get_attachment_image_should_use_wp_get_attachment_metadata() {
     2414        add_filter( 'wp_get_attachment_metadata', array( $this, 'filter_36246' ), 10, 2 );
    24152415
    24162416        remove_all_filters( 'wp_calculate_image_sizes' );
     
    24282428        $actual = wp_get_attachment_image( self::$large_id, 'testsize' );
    24292429
    2430         remove_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ) );
     2430        remove_filter( 'wp_get_attachment_metadata', array( $this, 'filter_36246' ) );
    24312431
    24322432        $this->assertSame( $expected, $actual );
    24332433    }
    24342434
    2435     function _filter_36246( $data, $attachment_id ) {
     2435    public function filter_36246( $data, $attachment_id ) {
    24362436        $data['sizes']['testsize'] = array(
    24372437            'file'      => 'test-image-testsize-999x999.jpg',
     
    24462446     * @ticket 50679
    24472447     */
    2448     function test_wp_get_attachment_metadata_should_return_false_if_no_attachment() {
     2448    public function test_wp_get_attachment_metadata_should_return_false_if_no_attachment() {
    24492449        $post_id = self::factory()->post->create();
    24502450        $data    = wp_get_attachment_metadata( $post_id );
     
    24742474     * @ticket 35218
    24752475     */
    2476     function test_wp_get_media_creation_timestamp_video_asf() {
     2476    public function test_wp_get_media_creation_timestamp_video_asf() {
    24772477        $metadata = array(
    24782478            'fileformat' => 'asf',
     
    24902490     * @ticket 35218
    24912491     */
    2492     function test_wp_get_media_creation_timestamp_video_matroska() {
     2492    public function test_wp_get_media_creation_timestamp_video_matroska() {
    24932493        $metadata = array(
    24942494            'fileformat' => 'matroska',
     
    25082508     * @ticket 35218
    25092509     */
    2510     function test_wp_get_media_creation_timestamp_video_quicktime() {
     2510    public function test_wp_get_media_creation_timestamp_video_quicktime() {
    25112511        $metadata = array(
    25122512            'fileformat' => 'quicktime',
     
    25282528     * @ticket 35218
    25292529     */
    2530     function test_wp_get_media_creation_timestamp_video_webm() {
     2530    public function test_wp_get_media_creation_timestamp_video_webm() {
    25312531        $metadata = array(
    25322532            'fileformat' => 'webm',
     
    25512551     * @ticket 42017
    25522552     */
    2553     function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
     2553    public function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
    25542554        $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
    25552555        $metadata = wp_read_audio_metadata( $video );
     
    25612561     * @ticket 35218
    25622562     */
    2563     function test_wp_read_video_metadata_adds_creation_date_with_quicktime() {
     2563    public function test_wp_read_video_metadata_adds_creation_date_with_quicktime() {
    25642564        $video    = DIR_TESTDATA . '/uploads/small-video.mov';
    25652565        $metadata = wp_read_video_metadata( $video );
     
    25712571     * @ticket 35218
    25722572     */
    2573     function test_wp_read_video_metadata_adds_creation_date_with_mp4() {
     2573    public function test_wp_read_video_metadata_adds_creation_date_with_mp4() {
    25742574        $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
    25752575        $metadata = wp_read_video_metadata( $video );
     
    25812581     * @ticket 35218
    25822582     */
    2583     function test_wp_read_video_metadata_adds_creation_date_with_mkv() {
     2583    public function test_wp_read_video_metadata_adds_creation_date_with_mkv() {
    25842584        $video    = DIR_TESTDATA . '/uploads/small-video.mkv';
    25852585        $metadata = wp_read_video_metadata( $video );
     
    25912591     * @ticket 35218
    25922592     */
    2593     function test_wp_read_video_metadata_adds_creation_date_with_webm() {
     2593    public function test_wp_read_video_metadata_adds_creation_date_with_webm() {
    25942594        $video    = DIR_TESTDATA . '/uploads/small-video.webm';
    25952595        $metadata = wp_read_video_metadata( $video );
     
    27002700     * @requires function imagejpeg
    27012701     */
    2702     function test_wp_filter_content_tags_width_height() {
     2702    public function test_wp_filter_content_tags_width_height() {
    27032703        $image_meta = wp_get_attachment_metadata( self::$large_id );
    2704         $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
     2704        $size_array = $this->get_image_size_array_from_meta( $image_meta, 'medium' );
    27052705
    27062706        $img                 = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    27472747     * @requires function imagejpeg
    27482748     */
    2749     function test_wp_filter_content_tags_loading_lazy() {
     2749    public function test_wp_filter_content_tags_loading_lazy() {
    27502750        $image_meta = wp_get_attachment_metadata( self::$large_id );
    2751         $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
     2751        $size_array = $this->get_image_size_array_from_meta( $image_meta, 'medium' );
    27522752
    27532753        $img                    = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    28032803     * @ticket 50756
    28042804     */
    2805     function test_wp_filter_content_tags_loading_lazy_opted_in() {
     2805    public function test_wp_filter_content_tags_loading_lazy_opted_in() {
    28062806        $img         = get_image_tag( self::$large_id, '', '', '', 'medium' );
    28072807        $lazy_img    = wp_img_tag_add_loading_attr( $img, 'test' );
     
    28332833     * @ticket 50756
    28342834     */
    2835     function test_wp_filter_content_tags_loading_lazy_opted_out() {
     2835    public function test_wp_filter_content_tags_loading_lazy_opted_out() {
    28362836        $img    = get_image_tag( self::$large_id, '', '', '', 'medium' );
    28372837        $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
     
    28592859     * @ticket 50367
    28602860     */
    2861     function test_wp_img_tag_add_loading_attr() {
     2861    public function test_wp_img_tag_add_loading_attr() {
    28622862        $img = '<img src="example.png" alt=" width="300" height="225" />';
    28632863        $img = wp_img_tag_add_loading_attr( $img, 'test' );
     
    28702870     * @ticket 50367
    28712871     */
    2872     function test_wp_img_tag_add_loading_attr_without_src() {
     2872    public function test_wp_img_tag_add_loading_attr_without_src() {
    28732873        $img = '<img alt=" width="300" height="225" />';
    28742874        $img = wp_img_tag_add_loading_attr( $img, 'test' );
     
    28812881     * @ticket 50367
    28822882     */
    2883     function test_wp_img_tag_add_loading_attr_with_single_quotes() {
     2883    public function test_wp_img_tag_add_loading_attr_with_single_quotes() {
    28842884        $img = "<img src='example.png' alt=' width='300' height='225' />";
    28852885        $img = wp_img_tag_add_loading_attr( $img, 'test' );
     
    28962896     * @ticket 50425
    28972897     */
    2898     function test_wp_img_tag_add_loading_attr_opt_out() {
     2898    public function test_wp_img_tag_add_loading_attr_opt_out() {
    28992899        $img = '<img src="example.png" alt=" width="300" height="225" />';
    29002900        add_filter( 'wp_img_tag_add_loading_attr', '__return_false' );
     
    29062906     * @ticket 50756
    29072907     */
    2908     function test_wp_iframe_tag_add_loading_attr() {
     2908    public function test_wp_iframe_tag_add_loading_attr() {
    29092909        $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
    29102910        $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' );
     
    29162916     * @ticket 50756
    29172917     */
    2918     function test_wp_iframe_tag_add_loading_attr_without_src() {
     2918    public function test_wp_iframe_tag_add_loading_attr_without_src() {
    29192919        $iframe = '<iframe width="640" height="360"></iframe>';
    29202920        $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' );
     
    29262926     * @ticket 50756
    29272927     */
    2928     function test_wp_iframe_tag_add_loading_attr_with_single_quotes() {
     2928    public function test_wp_iframe_tag_add_loading_attr_with_single_quotes() {
    29292929        $iframe = "<iframe src='https://www.example.com' width='640' height='360'></iframe>";
    29302930        $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' );
     
    29402940     * @ticket 50756
    29412941     */
    2942     function test_wp_iframe_tag_add_loading_attr_opt_out() {
     2942    public function test_wp_iframe_tag_add_loading_attr_opt_out() {
    29432943        $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
    29442944        add_filter( 'wp_iframe_tag_add_loading_attr', '__return_false' );
     
    29512951     * @ticket 52768
    29522952     */
    2953     function test_wp_iframe_tag_add_loading_attr_skip_wp_embed() {
     2953    public function test_wp_iframe_tag_add_loading_attr_skip_wp_embed() {
    29542954        $iframe   = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
    29552955        $fallback = '<blockquote>Fallback content.</blockquote>';
     
    29642964     * @ticket 50425
    29652965     */
    2966     function test_wp_get_attachment_image_loading() {
     2966    public function test_wp_get_attachment_image_loading() {
    29672967        $img = wp_get_attachment_image( self::$large_id );
    29682968
     
    29742974     * @ticket 50425
    29752975     */
    2976     function test_wp_get_attachment_image_loading_opt_out() {
     2976    public function test_wp_get_attachment_image_loading_opt_out() {
    29772977        add_filter( 'wp_lazy_loading_enabled', '__return_false' );
    29782978        $img = wp_get_attachment_image( self::$large_id );
     
    29862986     * @ticket 50425
    29872987     */
    2988     function test_wp_get_attachment_image_loading_opt_out_individual() {
     2988    public function test_wp_get_attachment_image_loading_opt_out_individual() {
    29892989        // The default is already tested above, the filter below ensures that
    29902990        // lazy-loading is definitely enabled globally for images.
     
    30063006     * @param bool   $expected Expected return value.
    30073007     */
    3008     function test_wp_lazy_loading_enabled_tag_name_defaults( $tag_name, $expected ) {
     3008    public function test_wp_lazy_loading_enabled_tag_name_defaults( $tag_name, $expected ) {
    30093009        if ( $expected ) {
    30103010            $this->assertTrue( wp_lazy_loading_enabled( $tag_name, 'the_content' ) );
     
    30143014    }
    30153015
    3016     function data_wp_lazy_loading_enabled_tag_name_defaults() {
     3016    public function data_wp_lazy_loading_enabled_tag_name_defaults() {
    30173017        return array(
    30183018            'img => true'            => array( 'img', true ),
     
    30303030     * @param bool   $expected Expected return value.
    30313031     */
    3032     function test_wp_lazy_loading_enabled_context_defaults( $context, $expected ) {
     3032    public function test_wp_lazy_loading_enabled_context_defaults( $context, $expected ) {
    30333033        if ( $expected ) {
    30343034            $this->assertTrue( wp_lazy_loading_enabled( 'img', $context ) );
     
    30383038    }
    30393039
    3040     function data_wp_lazy_loading_enabled_context_defaults() {
     3040    public function data_wp_lazy_loading_enabled_context_defaults() {
    30413041        return array(
    30423042            'wp_get_attachment_image => true' => array( 'wp_get_attachment_image', true ),
     
    30533053     * @ticket 50543
    30543054     */
    3055     function test_wp_image_file_matches_image_meta() {
     3055    public function test_wp_image_file_matches_image_meta() {
    30563056        $image_meta       = wp_get_attachment_metadata( self::$large_id );
    30573057        $image_src_full   = wp_get_attachment_image_url( self::$large_id, 'full' );
     
    30653065     * @ticket 50543
    30663066     */
    3067     function test_wp_image_file_matches_image_meta_no_subsizes() {
     3067    public function test_wp_image_file_matches_image_meta_no_subsizes() {
    30683068        $image_meta = wp_get_attachment_metadata( self::$large_id );
    30693069        $image_src  = wp_get_attachment_image_url( self::$large_id, 'full' );
     
    30773077     * @ticket 50543
    30783078     */
    3079     function test_wp_image_file_matches_image_meta_invalid_meta() {
     3079    public function test_wp_image_file_matches_image_meta_invalid_meta() {
    30803080        $image_meta = ''; // Attachment is not an image.
    30813081        $image_src  = $this->img_url;
     
    30873087     * @ticket 50543
    30883088     */
    3089     function test_wp_image_file_matches_image_meta_different_meta() {
     3089    public function test_wp_image_file_matches_image_meta_different_meta() {
    30903090        $image_meta = wp_get_attachment_metadata( self::$large_id );
    30913091        $image_src  = $this->img_url; // Different image.
     
    30973097     * @ticket 50543
    30983098     */
    3099     function test_wp_image_file_matches_image_meta_original_image() {
     3099    public function test_wp_image_file_matches_image_meta_original_image() {
    31003100        $image_meta = wp_get_attachment_metadata( self::$large_id );
    31013101        $image_src  = wp_get_original_image_url( self::$large_id );
     
    31073107     * @ticket 22101
    31083108     */
    3109     function test_gallery_shortcode_when_is_feed_true() {
     3109    public function test_gallery_shortcode_when_is_feed_true() {
    31103110
    31113111        $this->go_to( '/?feed=rss2' );
     
    31493149     *
    31503150     */
    3151     function test_attachment_permalinks_based_on_parent_status( $post_key, $expected_url, $expected_404 ) {
     3151    public function test_attachment_permalinks_based_on_parent_status( $post_key, $expected_url, $expected_404 ) {
    31523152        $this->set_permalink_structure( '/%postname%' );
    31533153        $post = get_post( self::$post_ids[ $post_key ] );
     
    31783178     * }
    31793179     */
    3180     function data_attachment_permalinks_based_on_parent_status() {
     3180    public function data_attachment_permalinks_based_on_parent_status() {
    31813181        return array(
    31823182            array( 'draft-attachment', '/?attachment_id=%ID%', true ),
Note: See TracChangeset for help on using the changeset viewer.