Make WordPress Core


Ignore:
Timestamp:
06/05/2024 12:21:46 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Login and Registration: Declare globals at the top of wp_signon() for consistency.

Follow-up to [10437], [32637], [58333].

See #58901.

File:
1 edited

Legend:

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

    r58333 r58341  
    425425
    426426        /**
    427          * Ensure that the user_activation_key is cleared (if available) after a successful login.
     427         * Ensure that `user_activation_key` is cleared after a successful login.
    428428         *
    429429         * @ticket 58901
     430         *
     431         * @covers ::wp_signon
    430432         */
    431433        public function test_user_activation_key_after_successful_login() {
    432434                global $wpdb;
    433435
    434                 $reset_key                    = get_password_reset_key( $this->user );
    435                 $user                         = wp_signon(
     436                $password_reset_key = get_password_reset_key( $this->user );
     437                $user               = wp_signon(
    436438                        array(
    437439                                'user_login'    => self::USER_LOGIN,
    … …  
    439441                        )
    440442                );
     443
    441444                $activation_key_from_database = $wpdb->get_var(
    442445                        $wpdb->prepare( "SELECT user_activation_key FROM $wpdb->users WHERE ID = %d", $this->user->ID )
    443446                );
    444447
    445                 $this->assertNotWPError( $reset_key, 'The password reset key was not created.' );
     448                $this->assertNotWPError( $password_reset_key, 'The password reset key was not created.' );
    446449                $this->assertNotWPError( $user, 'The user was not authenticated.' );
    447                 $this->assertEmpty( $user->user_activation_key, 'The `user_activation_key` was not empty on the user object returned by `wp_signon` function.' );
     450                $this->assertEmpty( $user->user_activation_key, 'The `user_activation_key` was not empty on the user object returned by `wp_signon()` function.' );
    448451                $this->assertEmpty( $activation_key_from_database, 'The `user_activation_key` was not empty in the database.' );
    449452        }
Note: See TracChangeset for help on using the changeset viewer.