public function test_isEmailAvailable() { $User = new User(); $User->username = "******"; $User->contact_email = "*****@*****.**"; $User->setPassword("letmein1234"); $this->assertTrue($User->isEmailAvailable("*****@*****.**")); $User->commit(); $this->assertFalse($User->isEmailAvailable("*****@*****.**")); $this->assertFalse($User->isEmailAvailable()); $Base = new Base(); $this->assertFalse($Base->email_available("*****@*****.**")); $this->assertTrue($Base->email_available("*****@*****.**")); $this->assertfalse($Base->email_available()); $Admin = new Admin(); $this->assertFalse($Admin->email_available("*****@*****.**")); $User = new User(); $this->setExpectedException("Exception", "Cannot check if email address is available because no email address was provided"); $this->assertFalse($User->isEmailAvailable()); }
/** * Constructor * @since Version 3.0 * @version 3.10.0 */ public function __construct() { $timer = Debug::getTimer(); Debug::RecordInstance(); parent::__construct(); $this->guest(); $this->Module = new Module("users"); foreach (func_get_args() as $arg) { if (filter_var($arg, FILTER_VALIDATE_INT)) { $this->id = $arg; $this->load(); } elseif (is_string($arg) && strlen($arg) > 1) { $query = "SELECT user_id FROM nuke_users WHERE username = ?"; $this->id = $this->db->fetchOne($query, $arg); if (filter_var($this->id, FILTER_VALIDATE_INT)) { $this->load(); } } } Debug::LogEvent(__METHOD__ . "(" . $this->id . ")", $timer); }
public function test_getUserFromEmail() { $Base = new Base(); $this->setExpectedException("Exception", "Can't find user - no email address provided"); $Base->getUserFromEmail(); }
/** * @depends test_newUser */ public function test_getNumRegistrationsByMonth($User) { $User->setUserAccountStatus(User::STATUS_ACTIVE); $Base = new Base(); $Database = AppCore::GetDatabase(); $From = new DateTime("today"); $To = new DateTime(); $Base->getNumRegistrationsByMonth($From, $To); }
/** * Constructor * @since Version 3.0 * @version 3.0 * @param object $db * @param array $preferences */ public function __construct() { if (RP_DEBUG) { global $site_debug; $debug_timer_start = microtime(true); } debug_recordInstance(__CLASS__); parent::__construct(); $this->guest(); $this->Module = new Module("users"); foreach (func_get_args() as $arg) { if (filter_var($arg, FILTER_VALIDATE_INT)) { $this->id = $arg; $this->load(); } elseif (is_string($arg) && strlen($arg) > 1) { $query = "SELECT user_id FROM nuke_users WHERE username = ?"; $this->id = $this->db->fetchOne($query, $arg); if (filter_var($this->id, FILTER_VALIDATE_INT)) { $this->load(); } } } if (RP_DEBUG) { $site_debug[] = "Railpage: " . __CLASS__ . "(" . $this->id . ") instantiated in " . round(microtime(true) - $debug_timer_start, 5) . "s"; } }