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:
Drew Jaynes
2015-10-06 05:34:47 +00:00
parent fabd554bb2
commit afe594bb7c
2 changed files with 26 additions and 1 deletions
+23
View File
@@ -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
*/