mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Users: Empty sanitized usernames should be considered invalid when passed through validate_username().
Adds tests. Props gwinhlopez for the initial patch. Props mordauk, chriscct7. Fixes #24618. git-svn-id: https://develop.svn.wordpress.org/trunk@34856 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -599,6 +599,29 @@ class Tests_User extends WP_UnitTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 24618
|
||||
*/
|
||||
public function test_validate_username_string() {
|
||||
$this->assertTrue( validate_username( rand_str() ) );
|
||||
$this->assertTrue( validate_username( 'JohnDoe' ) );
|
||||
$this->assertTrue( validate_username( 'test@test.com' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 24618
|
||||
*/
|
||||
public function test_validate_username_empty() {
|
||||
$this->assertFalse( validate_username( '' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 24618
|
||||
*/
|
||||
public function test_validate_username_invalid() {
|
||||
$this->assertFalse( validate_username( '@#&99sd' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 29696
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user