Exemplo n.º 1
0
 /**
  * @dataProvider providerGetPage
  */
 public function testGetPage($xid, $aid, $uid, $count, $first, $amount, $expected)
 {
     $cids = array();
     for ($i = 0; $i < $count; $i++) {
         $response = Api_Dao_Comments::createComment($xid, $aid, $uid, "fetching are we not? : {$i}");
         $this->assertTrue($response != false, "Test should have passed, mysql error? ");
         if ($response) {
             $cids[] = (string) $response;
         }
     }
     $cids = array_reverse($cids);
     $cids = array_slice($cids, $first, $amount);
     $commentCount = Api_Dao_Comments::getCommentCount($xid, $aid);
     $this->assertEquals($count, $commentCount);
     $fetchCids = Api_Dao_Comments::getCommentsByXidAndAid($xid, $aid, $first, $amount);
     $this->assertTrue($fetchCids !== null, "Test should have passed");
     $this->assertEquals($expected, count($fetchCids));
     $cidValues = array_values($cids);
     $fetchCidValues = array();
     foreach ($fetchCids as $comment) {
         $cid = $comment['cid'];
         $this->assertContains("" . $cid, $cidValues, "findBy returned a CID not inserted in this run ({$cid})");
         $fetchCidValues[] = $cid;
     }
     $fetchCidValues = array_values($fetchCidValues);
     foreach ($cids as $cid) {
         $this->assertContains("" . $cid, $fetchCidValues, "findBy did not return a CID which was inserted in this run ({$cid})");
     }
 }
Exemplo n.º 2
0
 /**
  * Enter description here...
  *
  * @param unknown_type $xid
  * @param unknown_type $aid
  * @param unknown_type $uid
  * @param unknown_type $text
  */
 public static function createComment($xid, $aid, $uid, $text)
 {
     return Api_Dao_Comments::createComment($xid, $aid, $uid, $text);
 }