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.

git-svn-id: https://develop.svn.wordpress.org/trunk@46650 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-11-04 15:04:41 +00:00
parent c231bb4869
commit 20165c2ffb
3 changed files with 19 additions and 37 deletions

View File

@@ -387,7 +387,7 @@ class Tests_Auth extends WP_UnitTestCase {
*
* @ticket 9568
*/
function test_log_in_using_email() {
public function test_log_in_using_email() {
$user_args = array(
'user_login' => 'johndoe',
'user_email' => 'mail@example.com',
@@ -398,4 +398,20 @@ class Tests_Auth extends WP_UnitTestCase {
$this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_email'], $user_args['user_pass'] ) );
$this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_login'], $user_args['user_pass'] ) );
}
/**
* @ticket 38744
*/
public function test_wp_signon_using_email_with_an_apostrophe() {
$user_args = array(
'user_email' => "mail\'@example.com",
'user_pass' => 'password',
);
$this->factory()->user->create( $user_args );
$_POST['log'] = $user_args['user_email'];
$_POST['pwd'] = $user_args['user_pass'];
$this->assertInstanceOf( 'WP_User', wp_signon() );
}
}