Make WordPress Core


Ignore:
Timestamp:
11/04/2019 03:04:41 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Login and Registration: Simplify the test for wp_signon() added in [46640].

Make sure it actually tests the change in behavior, previously it passed both before and after the patch.

Add wp_unslash() to the last remaining instance of $_POST['user_login'] that didn't have it.

See #38744.

File:
1 edited

Legend:

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

    r46643 r46650  
    3636                self::$user_ids[] = self::$contrib_id;
    3737
    38                 self::$user_ids[] = $factory->user->create(
    39                         array(
    40                                 'user_login'    => "testemailaddress'@test.com",
    41                                 'user_nicename' => 'user_email_with_apostrophe',
    42                                 'user_pass'     => 'password',
    43                                 'first_name'    => 'John',
    44                                 'last_name'     => 'Doe',
    45                                 'display_name'  => 'John Doe',
    46                                 'user_email'    => "testemailaddress'@test.com",
    47                                 'user_url'      => 'http://tacos.com',
    48                                 'role'          => 'contributor',
    49                                 'nickname'      => 'Johnny',
    50                                 'description'   => 'I am a WordPress user that cares about privacy.',
    51                         )
    52                 );
    53 
    5438                self::$author_id  = $factory->user->create(
    5539                        array(
    … …  
    6549                self::$editor_id  = $factory->user->create(
    6650                        array(
     51                                'user_email' => 'test@test.com',
    6752                                'role'       => 'editor',
    68                                 'user_email' => 'test@test.com',
    6953                        )
    7054                );
    … …  
    8064
    8165                $this->author = clone self::$_author;
    82         }
    83 
    84         public function test_that_you_can_login_with_an_email_that_has_apostrophe() {
    85 
    86                 // Create the user with an email that has an apostrophe (see test setup).
    87 
    88                 // Login as the user.
    89                 $credentials = [
    90                         'user_login'    => "testemailaddress'@test.com",
    91                         'user_password' => 'password',
    92                 ];
    93 
    94                 // Attempt to login.
    95                 $user = wp_signon( $credentials );
    96 
    97                 // Assert that the login was successfull.
    98                 // If the login fails, an instance of WP_Error is returned rather than User object.
    99                 $this->assertNotWPError( $user );
    10066        }
    10167
Note: See TracChangeset for help on using the changeset viewer.