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

    r51568 r52010  
    77    public $cache = null;
    88
    9     function set_up() {
     9    public function set_up() {
    1010        parent::set_up();
    1111        // Create two cache objects with a shared cache directory.
     
    1414    }
    1515
    16     function tear_down() {
     16    public function tear_down() {
    1717        $this->flush_cache();
    1818        parent::tear_down();
    1919    }
    2020
    21     function &init_cache() {
     21    private function &init_cache() {
    2222        global $wp_object_cache;
    2323        $cache_class = get_class( $wp_object_cache );
     
    2727    }
    2828
    29     function test_miss() {
     29    public function test_miss() {
    3030        $this->assertFalse( $this->cache->get( 'test_miss' ) );
    3131    }
    3232
    33     function test_add_get() {
     33    public function test_add_get() {
    3434        $key = __FUNCTION__;
    3535        $val = 'val';
     
    3939    }
    4040
    41     function test_add_get_0() {
     41    public function test_add_get_0() {
    4242        $key = __FUNCTION__;
    4343        $val = 0;
     
    5151     * @ticket 20004
    5252     */
    53     function test_add_get_null() {
     53    public function test_add_get_null() {
    5454        $key = __FUNCTION__;
    5555        $val = null;
     
    6363     * @ticket 20004
    6464     */
    65     function test_add_get_false() {
     65    public function test_add_get_false() {
    6666        $key = __FUNCTION__;
    6767        $val = false;
     
    7272    }
    7373
    74     function test_add() {
     74    public function test_add() {
    7575        $key  = __FUNCTION__;
    7676        $val1 = 'val1';
     
    8585    }
    8686
    87     function test_replace() {
     87    public function test_replace() {
    8888        $key  = __FUNCTION__;
    8989        $val  = 'val1';
     
    9999    }
    100100
    101     function test_set() {
     101    public function test_set() {
    102102        $key  = __FUNCTION__;
    103103        $val1 = 'val1';
     
    112112    }
    113113
    114     function test_flush() {
     114    public function test_flush() {
    115115        global $_wp_using_ext_object_cache;
    116116
     
    131131
    132132    // Make sure objects are cloned going to and from the cache.
    133     function test_object_refs() {
     133    public function test_object_refs() {
    134134        $key           = __FUNCTION__ . '_1';
    135135        $object_a      = new stdClass;
     
    153153    }
    154154
    155     function test_incr() {
     155    public function test_incr() {
    156156        $key = __FUNCTION__;
    157157
     
    166166    }
    167167
    168     function test_wp_cache_incr() {
     168    public function test_wp_cache_incr() {
    169169        $key = __FUNCTION__;
    170170
     
    179179    }
    180180
    181     function test_decr() {
     181    public function test_decr() {
    182182        $key = __FUNCTION__;
    183183
     
    199199     * @ticket 21327
    200200     */
    201     function test_wp_cache_decr() {
     201    public function test_wp_cache_decr() {
    202202        $key = __FUNCTION__;
    203203
     
    216216    }
    217217
    218     function test_delete() {
     218    public function test_delete() {
    219219        $key = __FUNCTION__;
    220220        $val = 'val';
     
    231231    }
    232232
    233     function test_wp_cache_delete() {
     233    public function test_wp_cache_delete() {
    234234        $key = __FUNCTION__;
    235235        $val = 'val';
     
    250250    }
    251251
    252     function test_switch_to_blog() {
     252    public function test_switch_to_blog() {
    253253        if ( ! method_exists( $this->cache, 'switch_to_blog' ) ) {
    254254            $this->markTestSkipped( 'This test requires a switch_to_blog() method on the cache object.' );
     
    296296    }
    297297
    298     function test_wp_cache_init() {
     298    public function test_wp_cache_init() {
    299299        $new_blank_cache_object = new WP_Object_Cache();
    300300        wp_cache_init();
     
    310310    }
    311311
    312     function test_wp_cache_replace() {
     312    public function test_wp_cache_replace() {
    313313        $key  = 'my-key';
    314314        $val1 = 'first-val';
Note: See TracChangeset for help on using the changeset viewer.