示例#1
0
 public function testGetType()
 {
     $service = new User();
     $service->setDataSource(self::$pdo);
     $user1 = $service->getType(1);
     $user2 = $service->getType(2);
     $user3 = $service->getType(100);
     $user4 = $service->getType(null);
     $this->assertTrue($user1->is_admin, 'Exists, is admin');
     $this->assertFalse($user2->is_admin, 'Exists, is not admin');
     $this->assertFalse($user3->is_admin, 'Does not exists');
     $this->assertFalse($user4->is_admin, 'ID is null');
 }
示例#2
0
 /**
  * Try to get type of user with no
  * storage connection
  * @expectedException Exception
  */
 public function testGetTypeException()
 {
     $service = new User();
     $service->setDataSource(new PDOMock());
     $service->getType(1);
 }