public function testValidateUsername() { $usernames = array('tester', 'test', 'test_', 'mr_freeze', 'r00t', 'The_quick_brown_foXXX'); foreach ($usernames as $name) { $this->assertTrue(Validator::isUsername($name)); } $no_usernames = array('mr.freeze', 'mr freeze', 'mr-freeze', '1337', '-91819', ' ', '<html></html>', '-_homer_-', '_test_', '04420', '', ' ', 'array()', 'x', '$234_&', '?test=1', '€uro', 'SupersupersupersupersupersupersupersupersupersupersuperMan'); foreach ($no_usernames as $username) { $this->assertFalse(Validator::isUsername($username)); } }