function testNoSpaces() { $r = new Rule_UserName(); $this->assertFalse($r->noSpaces("user test")); $this->assertFalse($r->noSpaces(" usertest")); $this->assertFalse($r->noSpaces("usertest ")); $this->assertFalse($r->noSpaces("user test 1")); $this->assertTrue($r->noSpaces("user")); }
/** * Check username validity. DEPRECATED * * @deprecated * @see Valid_UserNameFormat * @param String $name * @return Integer */ function account_namevalid($name, $key = '') { $rule = new Rule_UserName(); if (!$rule->isValid($name)) { $GLOBALS['register_error'] = $rule->getErrorMessage(); return 0; } return 1; }
/** * Check validity * * @param String $val * * @return Boolean */ public function isValid($val) { return $this->isDNSCompliant($val) && parent::isValid($val) && $this->isNameAvailable($val) && $this->getPendingProjectRename($val); }
function testReservedPrefix() { $r = new Rule_UserName(); $this->assertTrue($r->isReservedName("forge__")); $this->assertFalse($r->isReservedName("forgeron")); }