Esempio n. 1
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);
 }
Esempio n. 2
0
 public static function getOneUserApp($appId, $userId)
 {
     $id = Api_Dao_UsersApp::createUsersApp($appId, $userId);
     return Api_Dao_UsersApp::getUserAppById($id);
 }
Esempio n. 3
0
 /**
  * Enter description here...
  *
  * @param unknown_type $userId
  * @param unknown_type $appId
  * @param unknown_type $fbml
  */
 public static function setFBML($userId, $appId, $fbml)
 {
     $userApps = Api_Dao_UsersApp::getUserAppByAppIdAndUserId($userId, $appId);
     if (count($userApps) > 0) {
         $userApp = $userApps[0];
         $userApp->fbml = $fbml;
         $ret = $userApp->trySave();
         if ($ret) {
             return true;
         }
         return false;
     } else {
         return Api_Dao_UsersApp::createUsersApp($appId, $userId, 0, 0, 0, 0, 0, 0, 0, 'wide', 0, $fbml);
     }
 }