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/post/thumbnails.php

    r51568 r52010  
    3232    }
    3333
    34     function test_has_post_thumbnail() {
     34    public function test_has_post_thumbnail() {
    3535        $this->assertFalse( has_post_thumbnail( self::$post ) );
    3636        $this->assertFalse( has_post_thumbnail( self::$post->ID ) );
     
    5454    }
    5555
    56     function test_get_post_thumbnail_id() {
     56    public function test_get_post_thumbnail_id() {
    5757        $this->assertSame( 0, get_post_thumbnail_id( self::$post ) );
    5858        $this->assertSame( 0, get_post_thumbnail_id( self::$post->ID ) );
     
    6969    }
    7070
    71     function test_update_post_thumbnail_cache() {
     71    public function test_update_post_thumbnail_cache() {
    7272        set_post_thumbnail( self::$post, self::$attachment_id );
    7373
     
    9090     * @ticket 12235
    9191     */
    92     function test_get_the_post_thumbnail_caption() {
     92    public function test_get_the_post_thumbnail_caption() {
    9393        $this->assertSame( '', get_the_post_thumbnail_caption() );
    9494
     
    114114     * @ticket 12235
    115115     */
    116     function test_get_the_post_thumbnail_caption_empty() {
     116    public function test_get_the_post_thumbnail_caption_empty() {
    117117        $post_id       = self::factory()->post->create();
    118118        $attachment_id = self::factory()->attachment->create_object(
     
    134134     * @ticket 12235
    135135     */
    136     function test_the_post_thumbnail_caption() {
     136    public function test_the_post_thumbnail_caption() {
    137137        $caption = 'This is a caption.';
    138138
     
    154154    }
    155155
    156     function test_get_the_post_thumbnail() {
     156    public function test_get_the_post_thumbnail() {
    157157        $this->assertSame( '', get_the_post_thumbnail() );
    158158        $this->assertSame( '', get_the_post_thumbnail( self::$post ) );
     
    175175    }
    176176
    177     function test_the_post_thumbnail() {
     177    public function test_the_post_thumbnail() {
    178178
    179179        $this->expectOutputString( '' );
     
    203203     * @ticket 33070
    204204     */
    205     function test_get_the_post_thumbnail_url() {
     205    public function test_get_the_post_thumbnail_url() {
    206206        $this->assertFalse( has_post_thumbnail( self::$post ) );
    207207        $this->assertFalse( get_the_post_thumbnail_url() );
     
    221221     * @ticket 33070
    222222     */
    223     function test_get_the_post_thumbnail_url_with_invalid_post() {
     223    public function test_get_the_post_thumbnail_url_with_invalid_post() {
    224224        set_post_thumbnail( self::$post, self::$attachment_id );
    225225
     
    235235     * @ticket 33070
    236236     */
    237     function test_the_post_thumbnail_url() {
     237    public function test_the_post_thumbnail_url() {
    238238        $GLOBALS['post'] = self::$post;
    239239
     
    250250     * @ticket 12922
    251251     */
    252     function test__wp_preview_post_thumbnail_filter() {
     252    public function test__wp_preview_post_thumbnail_filter() {
    253253        $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null;
    254254
     
    270270     * @ticket 37697
    271271     */
    272     function test__wp_preview_post_thumbnail_filter_secondary_post() {
     272    public function test__wp_preview_post_thumbnail_filter_secondary_post() {
    273273        $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null;
    274274
     
    296296     * @ticket 12922
    297297     */
    298     function test_insert_post_with_post_thumbnail() {
     298    public function test_insert_post_with_post_thumbnail() {
    299299        $post_id = wp_insert_post(
    300300            array(
     
    327327     * @ticket 37658
    328328     */
    329     function test_insert_attachment_with_post_thumbnail() {
     329    public function test_insert_attachment_with_post_thumbnail() {
    330330        // Audio files support featured images.
    331331        $post_id = wp_insert_post(
     
    366366     * @ticket 39030
    367367     */
    368     function test_post_thumbnail_size_filter_simple() {
     368    public function test_post_thumbnail_size_filter_simple() {
    369369        $this->current_size_filter_data = 'medium';
    370370
     
    387387     * @dataProvider data_post_thumbnail_size_filter_complex
    388388     */
    389     function test_post_thumbnail_size_filter_complex( $which_post, $expected ) {
     389    public function test_post_thumbnail_size_filter_complex( $which_post, $expected ) {
    390390        $this->current_size_filter_data = array(
    391391            self::$post->ID           => 'medium',
     
    409409    }
    410410
    411     function data_post_thumbnail_size_filter_complex() {
     411    public function data_post_thumbnail_size_filter_complex() {
    412412        return array(
    413413            array( 0, 'medium' ),
     
    416416    }
    417417
    418     function filter_post_thumbnail_size( $size, $post_id ) {
     418    public function filter_post_thumbnail_size( $size, $post_id ) {
    419419        if ( is_array( $this->current_size_filter_data ) && isset( $this->current_size_filter_data[ $post_id ] ) ) {
    420420            return $this->current_size_filter_data[ $post_id ];
     
    428428    }
    429429
    430     function filter_set_post_thumbnail_size_result( $html, $post_id, $post_thumbnail_id, $size ) {
     430    public function filter_set_post_thumbnail_size_result( $html, $post_id, $post_thumbnail_id, $size ) {
    431431        $this->current_size_filter_result = $size;
    432432
Note: See TracChangeset for help on using the changeset viewer.