Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (5 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/auth.php

    r51568 r52010  
    3333        }
    3434
    35         function set_up() {
     35        public function set_up() {
    3636                parent::set_up();
    3737
    … …  
    5050        }
    5151
    52         function test_auth_cookie_valid() {
     52        public function test_auth_cookie_valid() {
    5353                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' );
    5454                $this->assertSame( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
    5555        }
    5656
    57         function test_auth_cookie_invalid() {
     57        public function test_auth_cookie_invalid() {
    5858                // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
    5959                // as an ajax test may have defined DOING_AJAX, failing the test.
    … …  
    7171        }
    7272
    73         function test_auth_cookie_scheme() {
     73        public function test_auth_cookie_scheme() {
    7474                // Arbitrary scheme name.
    7575                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' );
    … …  
    8484         * @ticket 23494
    8585         */
    86         function test_password_trimming() {
     86        public function test_password_trimming() {
    8787                $passwords_to_test = array(
    8888                        'a password with no trailing or leading spaces',
    … …  
    109109         * @ticket 24973
    110110         */
    111         function test_wp_hash_password_trimming() {
     111        public function test_wp_hash_password_trimming() {
    112112
    113113                $password = ' pass with leading whitespace';
    … …  
    130130         * @ticket 29217
    131131         */
    132         function test_wp_verify_nonce_with_empty_arg() {
     132        public function test_wp_verify_nonce_with_empty_arg() {
    133133                $this->assertFalse( wp_verify_nonce( '' ) );
    134134                $this->assertFalse( wp_verify_nonce( null ) );
    … …  
    138138         * @ticket 29542
    139139         */
    140         function test_wp_verify_nonce_with_integer_arg() {
     140        public function test_wp_verify_nonce_with_integer_arg() {
    141141                $this->assertFalse( wp_verify_nonce( 1 ) );
    142142        }
    … …  
    145145         * @ticket 24030
    146146         */
    147         function test_wp_nonce_verify_failed() {
     147        public function test_wp_nonce_verify_failed() {
    148148                $nonce = substr( md5( uniqid() ), 0, 10 );
    149149                $count = did_action( $this->nonce_failure_hook );
    … …  
    157157         * @ticket 24030
    158158         */
    159         function test_wp_nonce_verify_success() {
     159        public function test_wp_nonce_verify_success() {
    160160                $nonce = wp_create_nonce( 'nonce_test_action' );
    161161                $count = did_action( $this->nonce_failure_hook );
    … …  
    203203        }
    204204
    205         function test_password_length_limit() {
     205        public function test_password_length_limit() {
    206206                $limit = str_repeat( 'a', 4096 );
    207207
    … …  
    253253         * @ticket 45746
    254254         */
    255         function test_user_activation_key_is_saved() {
     255        public function test_user_activation_key_is_saved() {
    256256                $user = get_userdata( $this->user->ID );
    257257                $key  = get_password_reset_key( $user );
    … …  
    267267         * @ticket 32429
    268268         */
    269         function test_user_activation_key_is_checked() {
     269        public function test_user_activation_key_is_checked() {
    270270                global $wpdb;
    271271
    … …  
    305305         * @ticket 32429
    306306         */
    307         function test_expired_user_activation_key_is_rejected() {
     307        public function test_expired_user_activation_key_is_rejected() {
    308308                global $wpdb;
    309309
    … …  
    328328         * @ticket 32429
    329329         */
    330         function test_empty_user_activation_key_fails_key_check() {
     330        public function test_empty_user_activation_key_fails_key_check() {
    331331                // An empty user_activation_key should not allow any key to be accepted.
    332332                $check = check_password_reset_key( 'key', $this->user->user_login );
    … …  
    341341         * @ticket 32429
    342342         */
    343         function test_legacy_user_activation_key_is_rejected() {
     343        public function test_legacy_user_activation_key_is_rejected() {
    344344                global $wpdb;
    345345
    … …  
    371371         * @ticket 24783
    372372         */
    373         function test_plaintext_user_activation_key_is_rejected() {
     373        public function test_plaintext_user_activation_key_is_rejected() {
    374374                global $wpdb;
    375375
Note: See TracChangeset for help on using the changeset viewer.