Ejemplo n.º 1
0
 public function testautoincrementIntoDb()
 {
     $dbCon = RsOpenFBDbTestUtils::getDbCon();
     $password = "******";
     $username = "******";
     $user = new Api_Dao_User();
     $user->setUsername($username);
     $user->setPassword($password);
     try {
         $numRows = $this->getNumAllUsers($dbCon);
         $this->assertNull($user->getId());
         $user->insertIntoDb($dbCon);
         $this->assertEquals($numRows + 1, $this->getNumAllUsers($dbCon));
         $this->assertNotNull($user->getId());
         $row = $this->getUser($dbCon, $user->getId());
         $this->assertEquals($user->getId(), $row[id]);
         $this->assertEquals($password, $row['password']);
         $this->assertEquals($username, $row['username']);
     } catch (Exception $exception) {
         $user->deleteFromDb($dbCon);
         throw $exception;
     }
     $user->deleteFromDb($dbCon);
     $this->assertEquals($numRows, $this->getNumAllUsers($dbCon));
 }