/** * @dataProvider providerForDeleteRows */ public function testDleteRows($xid, $aid, $uid, $count) { $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; } } $commentCount = Api_Dao_Comments::getCommentCount($xid, $aid); $this->assertEquals($count, $commentCount); foreach ($cids as $key => $cid) { $ret = Api_Dao_Comments::deleteComment($cid, $xid, $aid); $this->assertTrue($ret > 0, "failed to delete from database"); $ret = Api_Dao_Comments::deleteComment($cid, $xid, $aid); $this->assertTrue($ret === 0, "Should have failed record already removed."); } $commentCount = Api_Dao_Comments::getCommentCount($xid, $aid); $this->assertEquals(0, $commentCount); }
/** * Enter description here... * * @param unknown_type $cid * @param unknown_type $xid * @param unknown_type $aid * @return unknown */ public static function deleteComment($cid, $xid, $aid) { return Api_Dao_Comments::deleteComment($cid, $xid, $aid); }