Make WordPress Core

Changeset 57892


Ignore:
Timestamp:
03/28/2024 11:17:02 AM (6 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use an existing user fixture in the test for logging in with an email address.

Creating a new user is redundant here, the fixture shared by other tests can be used instead.

Follow-up to [36617].

See #60705.

File:
1 edited

Legend:

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

    r57711 r57892  
    430430     */
    431431    public function test_log_in_using_email() {
    432         $user_args = array(
    433             'user_login' => 'johndoe',
    434             'user_email' => 'mail@example.com',
    435             'user_pass'  => 'password',
    436         );
    437         self::factory()->user->create( $user_args );
    438 
    439         $this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_email'], $user_args['user_pass'] ) );
    440         $this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_login'], $user_args['user_pass'] ) );
     432        $this->assertInstanceOf( 'WP_User', wp_authenticate( self::USER_EMAIL, self::USER_PASS ) );
     433        $this->assertInstanceOf( 'WP_User', wp_authenticate( self::USER_LOGIN, self::USER_PASS ) );
    441434    }
    442435
Note: See TracChangeset for help on using the changeset viewer.