コード例 #1
0
ファイル: Ratings.php プロジェクト: jkinner/ringside
 /**
  * Returns the ratings for the given item ids and user ids.
  *
  * @param unknown_type $app_id
  * @param unknown_type $iids
  * @param unknown_type $uids
  */
 public static function getRatings($app_id, $item_ids, $uids)
 {
     return Api_Dao_Ratings::getRatings($app_id, $item_ids, $uids)->toArray();
 }
コード例 #2
0
 public function testExecute()
 {
     $appId = 1;
     $app_id = 1;
     $uid = 18078;
     $iid = "RatingsTestCaseItem12";
     $vote = 4;
     $uids = "18078";
     $iids = "{$iid}";
     //RingsideAppsDbRatings::setRating(uid, iid, vote, units, dbCon)
     $apiParams = array();
     $apiParams['iid'] = $iid;
     $apiParams['vote'] = $vote;
     try {
         // Create our object
         $faf = $this->initRest(new RatingsSet(), $apiParams, $uid, $appId);
         $this->assertNotNull($faf, "RatingsSetRating should not be null!");
         $result = $faf->execute();
         //$response [ 'result' ] = $ret?'1':'0';
         $this->assertEquals($result['result'], '1', "Result should be 1, but is: " . $result['result']);
         // Set the rating for this user
         $retVal = Api_Dao_Ratings::getRatings($app_id, array($iids), array($uids));
         $a = $retVal[0]->toArray();
         $this->assertNotNull($a);
         $this->assertEquals($a['uid'], $uid, "UID: " . $a['uid'] . "!=" . $uid);
         $this->assertEquals($a['item_id'], $iid, "iid: " . $a['item_id'] . "!=" . $iid);
         $this->assertEquals($a['vote'], $vote, "Vote: " . $a['vote'] . "!=" . $vote);
     } catch (OpenFBAPIException $exception) {
         $this->fail($exception->getMessage() . "\n" . $exception->getTraceAsString());
     }
 }