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

    r51702 r52010  
    1111     * @covers ::do_action
    1212     */
    13     function test_simple_action() {
     13    public function test_simple_action() {
    1414        $a   = new MockAction();
    1515        $tag = __FUNCTION__;
     
    3131     * @covers ::remove_action
    3232     */
    33     function test_remove_action() {
     33    public function test_remove_action() {
    3434        $a   = new MockAction();
    3535        $tag = __FUNCTION__;
     
    5353     * @covers ::has_action
    5454     */
    55     function test_has_action() {
     55    public function test_has_action() {
    5656        $tag  = __FUNCTION__;
    5757        $func = __FUNCTION__ . '_func';
     
    7272     * @covers ::do_action
    7373     */
    74     function test_multiple_actions() {
     74    public function test_multiple_actions() {
    7575        $a1  = new MockAction();
    7676        $a2  = new MockAction();
     
    9393     * @covers ::do_action
    9494     */
    95     function test_action_args_1() {
     95    public function test_action_args_1() {
    9696        $a   = new MockAction();
    9797        $tag = __FUNCTION__;
     
    113113     * @covers ::do_action
    114114     */
    115     function test_action_args_2() {
     115    public function test_action_args_2() {
    116116        $a1   = new MockAction();
    117117        $a2   = new MockAction();
     
    147147     * @covers ::do_action
    148148     */
    149     function test_action_args_3() {
     149    public function test_action_args_3() {
    150150        $a1   = new MockAction();
    151151        $a2   = new MockAction();
     
    186186     * @covers ::do_action
    187187     */
    188     function test_action_args_with_php4_syntax() {
     188    public function test_action_args_with_php4_syntax() {
    189189        $a   = new MockAction();
    190190        $tag = __FUNCTION__;
     
    200200    }
    201201
    202     function test_action_priority() {
     202    public function test_action_priority() {
    203203        $a   = new MockAction();
    204204        $tag = __FUNCTION__;
     
    232232     * @covers ::did_action
    233233     */
    234     function test_did_action() {
     234    public function test_did_action() {
    235235        $tag1 = 'action1';
    236236        $tag2 = 'action2';
     
    256256     * @covers ::do_action
    257257     */
    258     function test_all_action() {
     258    public function test_all_action() {
    259259        $a    = new MockAction();
    260260        $tag1 = __FUNCTION__ . '_1';
     
    283283     * @covers ::remove_action
    284284     */
    285     function test_remove_all_action() {
     285    public function test_remove_all_action() {
    286286        $a   = new MockAction();
    287287        $tag = __FUNCTION__;
     
    306306     * @covers ::do_action_ref_array
    307307     */
    308     function test_action_ref_array() {
     308    public function test_action_ref_array() {
    309309        $obj = new stdClass();
    310310        $a   = new MockAction();
     
    327327     * @covers ::do_action
    328328     */
    329     function test_action_keyed_array() {
     329    public function test_action_keyed_array() {
    330330        $a = new MockAction();
    331331
     
    354354     * @covers ::remove_action
    355355     */
    356     function test_action_self_removal() {
     356    public function test_action_self_removal() {
    357357        add_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
    358358        do_action( 'test_action_self_removal' );
     
    360360    }
    361361
    362     function action_self_removal() {
     362    public function action_self_removal() {
    363363        remove_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
    364364    }
     
    369369     * @covers ::do_action
    370370     */
    371     function test_action_recursion() {
     371    public function test_action_recursion() {
    372372        $tag = __FUNCTION__;
    373373        $a   = new MockAction();
     
    386386     * @covers ::do_action
    387387     */
    388     function action_that_causes_recursion( $tag ) {
     388    public function action_that_causes_recursion( $tag ) {
    389389        static $recursing = false;
    390390        if ( ! $recursing ) {
     
    402402     * @covers ::add_action
    403403     */
    404     function test_action_callback_manipulation_while_running() {
     404    public function test_action_callback_manipulation_while_running() {
    405405        $tag = __FUNCTION__;
    406406        $a   = new MockAction();
     
    424424    }
    425425
    426     function action_that_manipulates_a_running_hook( $tag, $mocks ) {
     426    public function action_that_manipulates_a_running_hook( $tag, $mocks ) {
    427427        remove_action( $tag, array( $mocks[1], 'action' ), 12, 2 );
    428428        add_action( $tag, array( $mocks[2], 'action' ), 12, 2 );
     
    439439     * @covers ::remove_filter
    440440     */
    441     function test_remove_anonymous_callback() {
     441    public function test_remove_anonymous_callback() {
    442442        $tag = __FUNCTION__;
    443443        $a   = new MockAction();
     
    476476     * @covers WP_Hook::offsetUnset
    477477     */
    478     function test_array_access_of_wp_filter_global() {
     478    public function test_array_access_of_wp_filter_global() {
    479479        global $wp_filter;
    480480        $tag = __FUNCTION__;
     
    504504     * @covers ::current_action
    505505     */
    506     function test_current_action() {
     506    public function test_current_action() {
    507507        global $wp_current_filter;
    508508        $wp_current_filter[] = 'first';
     
    517517     * @covers ::doing_filter
    518518     */
    519     function test_doing_filter() {
     519    public function test_doing_filter() {
    520520        global $wp_current_filter;
    521521        $wp_current_filter = array(); // Set to an empty array first.
     
    538538     * @covers ::doing_filter
    539539     */
    540     function test_doing_action() {
     540    public function test_doing_action() {
    541541        global $wp_current_filter;
    542542        $wp_current_filter = array(); // Set to an empty array first.
     
    559559     * @covers ::doing_filter
    560560     */
    561     function test_doing_filter_real() {
     561    public function test_doing_filter_real() {
    562562        $this->assertFalse( doing_filter() );            // No filter is passed in, and no filter is being processed.
    563563        $this->assertFalse( doing_filter( 'testing' ) ); // Filter is passed in but not being processed.
     
    576576    }
    577577
    578     function apply_testing_filter() {
     578    public function apply_testing_filter() {
    579579        $this->apply_testing_filter = true;
    580580
     
    597597    }
    598598
    599     function apply_testing_nested_filter() {
     599    public function apply_testing_nested_filter() {
    600600        $this->apply_testing_nested_filter = true;
    601601        $this->assertTrue( doing_filter() );
Note: See TracChangeset for help on using the changeset viewer.