public function testExecute()
 {
     $appId = 2;
     $app_id = 2;
     $uid = 18034;
     $datatype = 1;
     $url = "http://ringsidenetworks.com";
     $refurl = "http://ringsidenetworks.com";
     $iid = "TestItemRemove5";
     $iids = $iid;
     try {
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $faf = $this->initRest(new ItemsRemove(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "ItemsRemove should not be null!");
         Api_Dao_Items::createItem($app_id, $iid, $url, $refurl, $datatype);
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $retVal = Api_Dao_Items::getInfo($app_id, $iids, $datatype);
         $this->assertEquals(count($retVal), 0, "GetInfo Count: " . count($retVal) . "!=0");
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 1;
     $app_id = 1;
     $uid = 18032;
     $iid = "Test Item FBML";
     $alid = 2;
     $fbml = "Some fbml to test with!";
     $lid = null;
     $uids = null;
     $apiParams = array();
     $apiParams['iid'] = $iid;
     $apiParams['fbml'] = $fbml;
     $apiParams['alid'] = $alid;
     try {
         // Set the FBML
         $faf = $this->initRest(new FavoritesSetFBML(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesSet should not be null!");
         Api_Dao_Items::createItem($app_id, $iid, "", "", 0);
         CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid);
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $faf = $this->initRest(new FavoritesGetFBML(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesGetFBML should not be null!");
         $retVal = $faf->execute();
         $a = $retVal['favorite'][1];
         $this->assertEquals($fbml, $a['fbml']);
         // Now test passin in the UID
         $uids = "18032";
         $apiParams['uids'] = $uids;
         $faf = $this->initRest(new FavoritesGetFBML(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesGetFBML should not be null!");
         $retVal = $faf->execute();
         $a = $retVal['favorite'][1];
         $this->assertEquals($a['fbml'], $fbml);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
Beispiel #3
0
 /**
  * Enter description here...
  *
  * @param unknown_type $app_id
  * @param unknown_type $iids
  * @param unknown_type $datatype
  */
 public static function getInfo($app_id, $iids, $datatype)
 {
     return Api_Dao_Items::getInfo($app_id, $iids, $datatype)->toArray();
 }
Beispiel #4
0
 /**
  * Enter description here...
  *
  * @param unknown_type $app_id
  * @param unknown_type $uid
  * @param unknown_type $item_id
  * @param unknown_type $alid
  * @param unknown_type $lid
  */
 public static function setFavorite($app_id, $uid, $item_id, $alid, $lid, $fbml)
 {
     self::checkLists($alid, $lid);
     if (Api_Dao_Items::isItemActive($app_id, $item_id)) {
         if (Api_Dao_Favorites::isFavorite($app_id, $uid, $item_id, $alid, $lid)) {
             if (!self::isEmpty($alid)) {
                 return Api_Dao_Favorites::updateFavoriteByAlid($app_id, $uid, $item_id, $alid, $fbml);
             } else {
                 return Api_Dao_Favorites::updateFavoriteByLid($app_id, $uid, $item_id, $lid, $fbml);
             }
         } else {
             return Api_Dao_Favorites::createFavorite($app_id, $uid, $item_id, $alid, $lid, $fbml);
         }
     }
     return false;
 }
 public function testExecute()
 {
     $appId = 10;
     $app_id = 10;
     $uid = 18066;
     $iid = "TestGetUsers1";
     $lid = null;
     $alid = 32;
     $uids = "18066";
     try {
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $apiParams['uids'] = $uids;
         $apiParams['alid'] = $alid;
         $faf = $this->initRest(new FavoritesGetUsers(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesGetUsers should not be null!");
         Api_Dao_Items::createItem($app_id, $iid, "", "", 0);
         CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid);
         $retVal = $faf->execute();
         $a = $retVal['user'][0];
         $this->assertEquals($uid, $a);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 1;
     $app_id = 1;
     $name = "Test User List";
     $uid = 18015;
     $iid = "Test Item Delete";
     $alid = 2;
     $lid = null;
     $uids = array("18015");
     $apiParams = array();
     $apiParams['iid'] = $iid;
     $apiParams['alid'] = $alid;
     try {
         // Test alid
         $faf = $this->initRest(new FavoritesDelete(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesDelete should not be null!");
         $this->assertTrue(Api_Dao_Items::createItem($app_id, $iid, "", "", 0) !== false);
         $this->assertTrue(CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid) !== false);
         $this->assertTrue(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should exist!");
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $this->assertFalse(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should no longer exist!");
         try {
             $alid = null;
             $lid = 1001;
             CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid);
             $this->fail("Create should not work if the user list does not exist!");
         } catch (Exception $e) {
             // ignore
         }
         // Now test lid
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $lid = CoreApiUtil::createList($name, $app_id, $uid);
         $apiParams['lid'] = $lid;
         CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid);
         $faf = $this->initRest(new FavoritesDelete(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesDelete should not be null!");
         $this->assertTrue(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should exist!");
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $this->assertFalse(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should no longer exist!");
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 2;
     $app_id = 2;
     $uid = 18034;
     $datatype = 1;
     $url = "http://ringsidenetworks.com";
     $refurl = "http://ringsidenetworks.com";
     $iid = "TestItemGetInfo2";
     $iids = $iid;
     try {
         // without datatype
         $apiParams = array();
         $apiParams['iids'] = $iids;
         $faf = $this->initRest(new ItemsGetInfo(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "ItemsGetInfo should not be null!");
         // with datatype
         $apiParams = array();
         $apiParams['iids'] = $iids;
         $apiParams['datatype'] = $datatype;
         $faf = $this->initRest(new ItemsGetInfo(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "ItemsGetInfo should not be null!");
         Api_Dao_Items::createItem($app_id, $iid, $url, $refurl, $datatype);
         $retVal = $faf->execute();
         $a = $retVal['item'][0];
         $this->assertNotNull($a);
         $this->assertEquals($a['iid'], $iid, "iid: " . $a['iid'] . "!=" . $iid);
         $this->assertEquals($a['url'], $url, "url: " . $a['url'] . "!=" . $url);
         $this->assertEquals($a['refurl'], $refurl, "refurl: " . $a['refurl'] . "!=" . $refurl);
         $this->assertEquals($a['datatype'], $datatype, "datatype: " . $a['datatype'] . "!=" . $datatype);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 67;
     $app_id = 67;
     $uid = 18036;
     $datatype = 55;
     $iid = "TestItemSetInfo14";
     $url = "http://www.ringsidenetworks.com";
     $refurl = "http://www.ringsidenetworks.com";
     $iids = $iid;
     try {
         // without datatype
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $apiParams['url'] = $url;
         $apiParams['refurl'] = $refurl;
         $faf = $this->initRest(new ItemsSetInfo(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "ItemsSetInfo should not be null!");
         // with datatype
         $apiParams = array();
         $apiParams['datatype'] = $datatype;
         $apiParams['iid'] = $iid;
         $apiParams['url'] = $url;
         $apiParams['refurl'] = $refurl;
         $faf = $this->initRest(new ItemsSetInfo(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "ItemsSetInfo should not be null!");
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $retVal = Api_Dao_Items::getInfo($app_id, $iids, $datatype);
         $a = $retVal[0]->toArray();
         $this->assertNotNull($a);
         $this->assertEquals($a['item_id'], $iid, "iid: " . $a['item_id'] . "!=" . $iid);
         $this->assertEquals($a['item_url'], $url, "url: " . $a['item_url'] . "!=" . $url);
         $this->assertEquals($a['item_refurl'], $refurl, "refurl: " . $a['item_refurl'] . "!=" . $refurl);
         $this->assertEquals($a['item_data_type'], $datatype, "datatype: " . $a['item_data_type'] . "!=" . $datatype);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 1;
     $app_id = 1;
     $name = "Test User List";
     $uid = 18015;
     $iid = "Test Item Delete";
     $alid = 2;
     $lid = null;
     $apiParams = array();
     $apiParams['iid'] = $iid;
     $apiParams['alid'] = $alid;
     try {
         // Test alid
         $faf = $this->initRest(new FavoritesGet(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesGet should not be null!");
         Api_Dao_Items::createItem($app_id, $iid, "", "", 0);
         CoreApiUtil::createFavorite($app_id, $uid, $iid, $alid, $lid);
         $result = $faf->execute();
         $ret = $result['favorite'][0];
         $this->assertEquals($alid, $ret['alid']);
         $this->assertEquals($iid, $ret['iid']);
         // Now test lid
         $alid = null;
         $lid = 1001;
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $lid = CoreApiUtil::createList($name, $app_id, $uid);
         $apiParams['lid'] = $lid;
         $cfRet = CoreApiUtil::createFavorite($app_id, $uid, $iid, null, $lid);
         $faf = $this->initRest(new FavoritesGet(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesDelete should not be null!");
         $result = $faf->execute();
         $ret = $result['favorite'][0];
         $this->assertEquals($lid, $ret['lid']);
         $this->assertEquals($iid, $ret['iid']);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }
 public function testExecute()
 {
     $appId = 1;
     $app_id = 1;
     $name = "Test User List";
     $uid = 18015;
     $iid = "Test Item Delete";
     $alid = 2;
     $lid = null;
     $uids = array("18015");
     $apiParams = array();
     $apiParams['iid'] = $iid;
     $apiParams['alid'] = $alid;
     try {
         // Test alid
         $faf = $this->initRest(new FavoritesSet(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesSet should not be null!");
         Api_Dao_Items::createItem($appId, $iid, '', '', '0');
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $this->assertTrue(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should exist!");
         // Now test lid
         $alid = null;
         $apiParams = array();
         $apiParams['iid'] = $iid;
         $lid = CoreApiUtil::createList($name, $app_id, $uid);
         $apiParams['lid'] = $lid;
         $faf = $this->initRest(new FavoritesSet(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "FavoritesSet should not be null!");
         $result = $faf->execute();
         $this->assertEquals($result['result'], '1');
         $this->assertTrue(CoreApiUtil::isFavorite($app_id, $iid, $alid, $lid, $uids), "Favorite should exist!");
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception);
     }
 }