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/taxonomy.php

    r51438 r52010  
    55 */
    66class Tests_Taxonomy extends WP_UnitTestCase {
    7     function test_get_post_taxonomies() {
     7    public function test_get_post_taxonomies() {
    88        $this->assertSame( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) );
    99    }
    1010
    11     function test_get_link_taxonomies() {
     11    public function test_get_link_taxonomies() {
    1212        $this->assertSame( array( 'link_category' ), get_object_taxonomies( 'link' ) );
    1313    }
     
    1616     * @ticket 5417
    1717     */
    18     function test_get_unknown_taxonomies() {
     18    public function test_get_unknown_taxonomies() {
    1919        // Taxonomies for an unknown object type.
    2020        $this->assertSame( array(), get_object_taxonomies( rand_str() ) );
     
    2424    }
    2525
    26     function test_get_post_taxonomy() {
     26    public function test_get_post_taxonomy() {
    2727        foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
    2828            $tax = get_taxonomy( $taxonomy );
     
    3434    }
    3535
    36     function test_get_the_taxonomies() {
     36    public function test_get_the_taxonomies() {
    3737        $post_id = self::factory()->post->create();
    3838
     
    6464    }
    6565
    66     function test_the_taxonomies() {
     66    public function test_the_taxonomies() {
    6767        $post_id = self::factory()->post->create();
    6868
     
    7979     * @ticket 27238
    8080     */
    81     function test_the_taxonomies_term_template() {
     81    public function test_the_taxonomies_term_template() {
    8282        $post_id = self::factory()->post->create();
    8383
     
    106106    }
    107107
    108     function test_get_link_taxonomy() {
     108    public function test_get_link_taxonomy() {
    109109        foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) {
    110110            $tax = get_taxonomy( $taxonomy );
     
    116116    }
    117117
    118     function test_taxonomy_exists_known() {
     118    public function test_taxonomy_exists_known() {
    119119        $this->assertTrue( taxonomy_exists( 'category' ) );
    120120        $this->assertTrue( taxonomy_exists( 'post_tag' ) );
     
    122122    }
    123123
    124     function test_taxonomy_exists_unknown() {
     124    public function test_taxonomy_exists_unknown() {
    125125        $this->assertFalse( taxonomy_exists( rand_str() ) );
    126126        $this->assertFalse( taxonomy_exists( '' ) );
     
    129129    }
    130130
    131     function test_is_taxonomy_hierarchical() {
     131    public function test_is_taxonomy_hierarchical() {
    132132        $this->assertTrue( is_taxonomy_hierarchical( 'category' ) );
    133133        $this->assertFalse( is_taxonomy_hierarchical( 'post_tag' ) );
     
    135135    }
    136136
    137     function test_is_taxonomy_hierarchical_unknown() {
     137    public function test_is_taxonomy_hierarchical_unknown() {
    138138        $this->assertFalse( is_taxonomy_hierarchical( rand_str() ) );
    139139        $this->assertFalse( is_taxonomy_hierarchical( '' ) );
     
    142142    }
    143143
    144     function test_register_taxonomy() {
     144    public function test_register_taxonomy() {
    145145
    146146        // Make up a new taxonomy name, and ensure it's unused.
     
    156156    }
    157157
    158     function test_register_hierarchical_taxonomy() {
     158    public function test_register_hierarchical_taxonomy() {
    159159
    160160        // Make up a new taxonomy name, and ensure it's unused.
     
    173173     * @ticket 48558
    174174     */
    175     function test_register_taxonomy_return_value() {
     175    public function test_register_taxonomy_return_value() {
    176176        $this->assertInstanceOf( 'WP_Taxonomy', register_taxonomy( 'foo', 'post' ) );
    177177    }
     
    182182     * @expectedIncorrectUsage register_taxonomy
    183183     */
    184     function test_register_taxonomy_with_too_long_name() {
     184    public function test_register_taxonomy_with_too_long_name() {
    185185        $this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
    186186    }
     
    191191     * @expectedIncorrectUsage register_taxonomy
    192192     */
    193     function test_register_taxonomy_with_empty_name() {
     193    public function test_register_taxonomy_with_empty_name() {
    194194        $this->assertInstanceOf( 'WP_Error', register_taxonomy( '', 'post', array() ) );
    195195    }
     
    225225     * @ticket 11058
    226226     */
    227     function test_registering_taxonomies_to_object_types() {
     227    public function test_registering_taxonomies_to_object_types() {
    228228        // Create a taxonomy to test with.
    229229        $tax = 'test_tax';
     
    401401     * @ticket 25706
    402402     */
    403     function test_in_category() {
     403    public function test_in_category() {
    404404        $post = self::factory()->post->create_and_get();
    405405
     
    415415    }
    416416
    417     function test_insert_category_create() {
     417    public function test_insert_category_create() {
    418418        $cat = array(
    419419            'cat_ID'   => 0,
     
    424424    }
    425425
    426     function test_insert_category_update() {
     426    public function test_insert_category_update() {
    427427        $cat = array(
    428428            'cat_ID'   => 1,
     
    433433    }
    434434
    435     function test_insert_category_force_error_handle() {
     435    public function test_insert_category_force_error_handle() {
    436436        $cat = array(
    437437            'cat_ID'   => 0,
     
    442442    }
    443443
    444     function test_insert_category_force_error_no_handle() {
     444    public function test_insert_category_force_error_no_handle() {
    445445        $cat = array(
    446446            'cat_ID'   => 0,
     
    972972     * @ticket 43517
    973973     */
    974     function test_default_term_for_custom_taxonomy() {
     974    public function test_default_term_for_custom_taxonomy() {
    975975
    976976        wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
     
    10371037     * @ticket 51320
    10381038     */
    1039     function test_default_term_for_post_in_multiple_taxonomies() {
     1039    public function test_default_term_for_post_in_multiple_taxonomies() {
    10401040        $post_type = 'test_post_type';
    10411041        $tax1      = 'test_tax1';
Note: See TracChangeset for help on using the changeset viewer.