Пример #1
0
 public function test_getRanks()
 {
     $Base = new Base();
     $this->assertEquals(0, count($Base->getRanks()));
     $Base->addCustomRank("Test rank");
     $Admin = new Admin();
     $ranks = $Admin->ranks();
     $this->assertEquals("ok", $ranks['stat']);
     $this->assertEquals(1, count($Base->getRanks()));
     $this->setExpectedException("Exception", "No rank text given");
     $Base->addCustomRank();
 }
Пример #2
0
 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());
 }
Пример #3
0
 /**
  * @depends test_updateSessionTime
  */
 public function test_memberList($User)
 {
     $User->setUserAccountStatus(User::STATUS_ACTIVE);
     $Admin = new Admin();
     $members = $Admin->memberList();
     $this->assertTrue(is_array($members));
     $this->assertTrue(count($members) > 0);
     $this->assertTrue(count($members['members']) == 1);
     $this->assertEquals($User->id, $members['members'][key($members['members'])]['id']);
 }
Пример #4
0
 /**
  * Validate changes to this item
  * @since Version 3.10.0
  * @return boolean
  */
 private function validate()
 {
     if (!$this->Date instanceof DateTime && empty($this->Date)) {
         $this->Date = new DateTime();
     }
     if (is_null($this->user_id)) {
         $this->user_id = 0;
     }
     if (is_null($this->assigned_to)) {
         $this->assigned_to = 0;
     }
     if (is_null($this->username)) {
         $this->username = "";
     }
     if (!filter_var($this->status_id, FILTER_VALIDATE_INT)) {
         $this->status_id = 1;
     }
     if ($this->user_id == 0 && !empty($this->username)) {
         $UserAdmin = new UserAdmin();
         $search = $UserAdmin->find($this->username, true);
         foreach ($search as $User) {
             $this->user_id = $User->id;
             break;
         }
     }
     return true;
 }