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

    r51568 r52010  
    1919     * @since 4.5.0
    2020     */
    21     function set_up() {
     21    public function set_up() {
    2222        parent::set_up();
    2323
     
    2525    }
    2626
    27     function test_register_post_type() {
     27    public function test_register_post_type() {
    2828        $this->assertNull( get_post_type_object( 'foo' ) );
    2929        register_post_type( 'foo' );
     
    4343     * @ticket 48558
    4444     */
    45     function test_register_post_type_return_value() {
     45    public function test_register_post_type_return_value() {
    4646        $this->assertInstanceOf( 'WP_Post_Type', register_post_type( 'foo' ) );
    4747    }
     
    5252     * @expectedIncorrectUsage register_post_type
    5353     */
    54     function test_register_post_type_with_too_long_name() {
     54    public function test_register_post_type_with_too_long_name() {
    5555        // Post type too long.
    5656        $this->assertInstanceOf( 'WP_Error', register_post_type( 'abcdefghijklmnopqrstuvwxyz0123456789' ) );
     
    6262     * @expectedIncorrectUsage register_post_type
    6363     */
    64     function test_register_post_type_with_empty_name() {
     64    public function test_register_post_type_with_empty_name() {
    6565        // Post type too short.
    6666        $this->assertInstanceOf( 'WP_Error', register_post_type( '' ) );
     
    7171     * @covers ::register_post_type
    7272     */
    73     function test_register_post_type_exclude_from_search_should_default_to_opposite_value_of_public() {
     73    public function test_register_post_type_exclude_from_search_should_default_to_opposite_value_of_public() {
    7474        /*
    7575         * 'public'              Default is false
     
    8585     * @covers ::register_post_type
    8686     */
    87     function test_register_post_type_publicly_queryable_should_default_to_value_of_public() {
     87    public function test_register_post_type_publicly_queryable_should_default_to_value_of_public() {
    8888        /*
    8989         * 'public'             Default is false
     
    9999     * @covers ::register_post_type
    100100     */
    101     function test_register_post_type_show_ui_should_default_to_value_of_public() {
     101    public function test_register_post_type_show_ui_should_default_to_value_of_public() {
    102102        /*
    103103         * 'public'  Default is false
     
    113113     * @covers ::register_post_type
    114114     */
    115     function test_register_post_type_show_in_menu_should_default_to_value_of_show_ui() {
     115    public function test_register_post_type_show_in_menu_should_default_to_value_of_show_ui() {
    116116        /*
    117117         * 'public'      Default is false
     
    132132     * @covers ::register_post_type
    133133     */
    134     function test_register_post_type_show_in_nav_menus_should_default_to_value_of_public() {
     134    public function test_register_post_type_show_in_nav_menus_should_default_to_value_of_public() {
    135135        /*
    136136         * 'public'            Default is false
     
    146146     * @covers ::register_post_type
    147147     */
    148     function test_register_post_type_show_in_admin_bar_should_default_to_value_of_show_in_menu() {
     148    public function test_register_post_type_show_in_admin_bar_should_default_to_value_of_show_in_menu() {
    149149        /*
    150150         * 'public'            Default is false
     
    164164    }
    165165
    166     function test_register_taxonomy_for_object_type() {
     166    public function test_register_taxonomy_for_object_type() {
    167167        global $wp_taxonomies;
    168168
     
    186186    }
    187187
    188     function test_post_type_exists() {
     188    public function test_post_type_exists() {
    189189        $this->assertFalse( post_type_exists( 'notaposttype' ) );
    190190        $this->assertTrue( post_type_exists( 'post' ) );
    191191    }
    192192
    193     function test_post_type_supports() {
     193    public function test_post_type_supports() {
    194194        $this->assertTrue( post_type_supports( 'post', 'post-formats' ) );
    195195        $this->assertFalse( post_type_supports( 'page', 'post-formats' ) );
     
    202202     * @ticket 21586
    203203     */
    204     function test_post_type_with_no_support() {
     204    public function test_post_type_with_no_support() {
    205205        register_post_type( 'foo', array( 'supports' => array() ) );
    206206        $this->assertTrue( post_type_supports( 'foo', 'editor' ) );
     
    217217     * @ticket 23302
    218218     */
    219     function test_post_type_with_no_feed() {
     219    public function test_post_type_with_no_feed() {
    220220        global $wp_rewrite;
    221221        $old_permastruct = get_option( 'permalink_structure' );
Note: See TracChangeset for help on using the changeset viewer.