Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/auth.php

    r46650 r47122  
    1212
    1313        /**
    14          * action hook
     14         * Action hook.
    1515         */
    1616        protected $nonce_failure_hook = 'wp_verify_nonce_failed';
    … …  
    5858
    5959        function test_auth_cookie_scheme() {
    60                 // arbitrary scheme name
     60                // Arbitrary scheme name.
    6161                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' );
    6262                $this->assertEquals( self::$user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );
    6363
    64                 // wrong scheme name - should fail
     64                // Wrong scheme name - should fail.
    6565                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' );
    6666                $this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
    … …  
    158158                $this->setExpectedIncorrectUsage( 'check_admin_referer' );
    159159
    160                 // A valid nonce needs to be set so the check doesn't die()
     160                // A valid nonce needs to be set so the check doesn't die().
    161161                $_REQUEST['_wpnonce'] = wp_create_nonce( -1 );
    162162                $result               = check_admin_referer();
    … …  
    167167
    168168        public function test_check_admin_referer_with_default_action_as_string_not_doing_it_wrong() {
    169                 // A valid nonce needs to be set so the check doesn't die()
     169                // A valid nonce needs to be set so the check doesn't die().
    170170                $_REQUEST['_wpnonce'] = wp_create_nonce( '-1' );
    171171                $result               = check_admin_referer( '-1' );
    … …  
    181181                $this->setExpectedIncorrectUsage( 'check_ajax_referer' );
    182182
    183                 // A valid nonce needs to be set so the check doesn't die()
     183                // A valid nonce needs to be set so the check doesn't die().
    184184                $_REQUEST['_wpnonce'] = wp_create_nonce( -1 );
    185185                $result               = check_ajax_referer();
    … …  
    193193
    194194                wp_set_password( $limit, self::$user_id );
    195                 // phpass hashed password
     195                // phpass hashed password.
    196196                $this->assertStringStartsWith( '$P$', $this->user->data->user_pass );
    197197
    198198                $user = wp_authenticate( $this->user->user_login, 'aaaaaaaa' );
    199                 // Wrong Password
     199                // Wrong password.
    200200                $this->assertInstanceOf( 'WP_Error', $user );
    201201
    … …  
    204204                $this->assertEquals( self::$user_id, $user->ID );
    205205
    206                 // one char too many
     206                // One char too many.
    207207                $user = wp_authenticate( $this->user->user_login, $limit . 'a' );
    208                 // Wrong Password
     208                // Wrong password.
    209209                $this->assertInstanceOf( 'WP_Error', $user );
    210210
    … …  
    224224
    225225                $user = wp_authenticate( $this->user->user_login, 'aaaaaaaa' );
    226                 // Wrong Password
     226                // Wrong password.
    227227                $this->assertInstanceOf( 'WP_Error', $user );
    228228
    229229                $user = wp_authenticate( $this->user->user_login, $limit );
    230                 // Wrong Password
     230                // Wrong password.
    231231                $this->assertInstanceOf( 'WP_Error', $user );
    232232
    … …  
    243243                $key  = get_password_reset_key( $user );
    244244
    245                 // A correctly saved key should be accepted
     245                // A correctly saved key should be accepted.
    246246                $check = check_password_reset_key( $key, $this->user->user_login );
    247247                $this->assertNotWPError( $check );
    … …  
    268268                clean_user_cache( $this->user );
    269269
    270                 // A valid key should be accepted
     270                // A valid key should be accepted.
    271271                $check = check_password_reset_key( $key, $this->user->user_login );
    272272                $this->assertNotWPError( $check );
    … …  
    274274                $this->assertSame( $this->user->ID, $check->ID );
    275275
    276                 // An invalid key should be rejected
     276                // An invalid key should be rejected.
    277277                $check = check_password_reset_key( 'key', $this->user->user_login );
    278278                $this->assertInstanceOf( 'WP_Error', $check );
    279279
    280                 // An empty key should be rejected
     280                // An empty key should be rejected.
    281281                $check = check_password_reset_key( '', $this->user->user_login );
    282282                $this->assertInstanceOf( 'WP_Error', $check );
    283283
    284                 // A truncated key should be rejected
     284                // A truncated key should be rejected.
    285285                $partial = substr( $key, 0, 10 );
    286286                $check   = check_password_reset_key( $partial, $this->user->user_login );
    … …  
    306306                clean_user_cache( $this->user );
    307307
    308                 // An expired but otherwise valid key should be rejected
     308                // An expired but otherwise valid key should be rejected.
    309309                $check = check_password_reset_key( $key, $this->user->user_login );
    310310                $this->assertInstanceOf( 'WP_Error', $check );
    … …  
    315315         */
    316316        function test_empty_user_activation_key_fails_key_check() {
    317                 // An empty user_activation_key should not allow any key to be accepted
     317                // An empty user_activation_key should not allow any key to be accepted.
    318318                $check = check_password_reset_key( 'key', $this->user->user_login );
    319319                $this->assertInstanceOf( 'WP_Error', $check );
    320320
    321                 // An empty user_activation_key should not allow an empty key to be accepted
     321                // An empty user_activation_key should not allow an empty key to be accepted.
    322322                $check = check_password_reset_key( '', $this->user->user_login );
    323323                $this->assertInstanceOf( 'WP_Error', $check );
    … …  
    344344                clean_user_cache( $this->user );
    345345
    346                 // A legacy user_activation_key should not be accepted
     346                // A legacy user_activation_key should not be accepted.
    347347                $check = check_password_reset_key( $key, $this->user->user_login );
    348348                $this->assertInstanceOf( 'WP_Error', $check );
    349349
    350                 // An empty key with a legacy user_activation_key should be rejected
     350                // An empty key with a legacy user_activation_key should be rejected.
    351351                $check = check_password_reset_key( '', $this->user->user_login );
    352352                $this->assertInstanceOf( 'WP_Error', $check );
    … …  
    374374                clean_user_cache( $this->user );
    375375
    376                 // A plaintext user_activation_key should not allow an otherwise valid key to be accepted
     376                // A plaintext user_activation_key should not allow an otherwise valid key to be accepted.
    377377                $check = check_password_reset_key( $key, $this->user->user_login );
    378378                $this->assertInstanceOf( 'WP_Error', $check );
    379379
    380                 // A plaintext user_activation_key should not allow an empty key to be accepted
     380                // A plaintext user_activation_key should not allow an empty key to be accepted.
    381381                $check = check_password_reset_key( '', $this->user->user_login );
    382382                $this->assertInstanceOf( 'WP_Error', $check );
Note: See TracChangeset for help on using the changeset viewer.