Ejemplo n.º 1
0
 public function initPhotoTags()
 {
     $dbCon = RsOpenFBDbTestUtils::getDbCon();
     $user1 = RsOpenFBDbTestUtils::getUser1();
     $user2 = RsOpenFBDbTestUtils::getUser2();
     $photoTag1 = RsOpenFBDbTestUtils::getPhotoTag1();
     $photoTag2 = RsOpenFBDbTestUtils::getPhotoTag2();
     $photoTag3 = RsOpenFBDbTestUtils::getPhotoTag3();
 }
Ejemplo n.º 2
0
 public function testinsertIntoDbdeleteFromDb()
 {
     $dbCon = RsOpenFBDbTestUtils::getDbCon();
     $user = RsOpenFBDbTestUtils::getUser1();
     $app = RsOpenFBDbTestUtils::getApp1();
     try {
         $user->insertIntoDb($dbCon);
     } catch (Exception $exception) {
         // nothing on purpose
     }
     $appId = $app;
     $userId = $user->getId();
     $id = null;
     try {
         $this->assertEquals(0, $this->getNumUserApp($appId, $userId));
         $id = Api_Dao_UsersApp::createUsersApp($appId, $userId);
         $this->assertEquals(1, $this->getNumUserApp($appId, $userId));
         $row = $this->getUserApp($appId, $userId);
         $this->assertEquals($id, $row['id']);
     } catch (Exception $exception) {
         try {
             Api_Dao_UsersApp::deleteUserApp($id);
         } catch (Exception $exception) {
             // nothing on purpose
         }
         $this->deleteUserAndApp($id, $app);
         throw $exception;
     }
     try {
         Api_Dao_UsersApp::deleteUserApp($id);
         $this->assertEquals(0, $this->getNumUserApp($appId, $userId));
     } catch (Exception $exception) {
         $this->deleteUserAndApp($id, $app);
         throw $exception;
     }
     $this->deleteUserAndApp($id, $app);
 }
Ejemplo n.º 3
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));
 }
Ejemplo n.º 4
0
 /**
  * @dataProvider providerIsAdmin
  */
 public function testIsAdmin($pageId, $uid, $expected)
 {
     $actual = Api_Dao_Pages::isAdmin($pageId, $uid, RsOpenFBDbTestUtils::getDbCon());
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 5
0
 public function testautoincrementIntoDb()
 {
     $dbCon = RsOpenFBDbTestUtils::getDbCon();
     $apiKey = "apiKe";
     $callbackUrl = "dbUrl";
     $canvasUrl = "canUrl";
     $default = 1;
     $name = "name";
     $secretKey = "secKey";
     $sidenavUrl = "sideUrl";
     try {
         $numRows = $this->getNumAllApps($dbCon);
         $id = Api_Dao_App::createApp($apiKey, $callbackUrl, $canvasUrl, $name, $default, $secretKey, $sidenavUrl, null, null);
         $this->assertEquals($numRows + 1, $this->getNumAllApps($dbCon));
         $row = $this->getApp($dbCon, $id);
         $this->assertEquals($callbackUrl, $row['callback_url']);
         $this->assertEquals($canvasUrl, $row['canvas_url']);
         $this->assertEquals($default, $row['isdefault']);
         $this->assertEquals($id, $row['id']);
         $this->assertEquals($name, $row['name']);
         $this->assertEquals($sidenavUrl, $row['sidenav_url']);
     } catch (Exception $exception) {
         Api_Dao_App::deleteApp($id);
         throw $exception;
     }
     Api_Dao_App::deleteApp($id);
     $this->assertEquals($numRows, $this->getNumAllApps($dbCon));
 }