Example #1
0
 public function testDeleteNotExistingLike()
 {
     $like = new ModelLike(null, 100);
     $this->assertEquals($like->deleteLike(), 0);
     $actual = $this->getConnection()->createDataSet(array('likes'));
     $expected = $this->createFlatXmlDataSet('_files/likes.xml');
     $this->assertDataSetsEqual($expected, $actual);
 }
Example #2
0
 public function deleteMessage()
 {
     $query = "DELETE FROM messages\n                 WHERE id=" . $this->id . " AND username = '******' AND thread_id=" . $this->thread_id;
     $res = db::query($query);
     if ($res) {
         $like = new ModelLike($this->user, $this->id);
         $like->deleteLike();
         $attch = new ModelAttachment($this->id, null, null);
         $attch->delAttachments();
     }
     return $res->rowCount();
 }