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'); }
/** * 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); }