public function DownAction() { // AF: Set thumb down for a comment $commentId = $this->params()->fromRoute('id', 0); $comments = new BusuuTest(); $comments->exchangeArray($this->getCommentTable()->getComment($commentId, false)); return new ViewModel(array('comment' => $this->getCommentTable()->rateComment($comments->comment))); }
public function testExchangeArraySetsPropertiesCorrectly() { $comments = new BusuuTest(); $data = array('Id' => 1, 'UserId' => 1, 'CommentText' => 'Arthur first text'); $comments->exchangeArray($data); $this->assertSame($data['Id'], $comments->comment['Id'], '"Comment id" was not set correctly'); $this->assertSame($data['UserId'], $comments->comment['UserId'], '"UserId" was not set correctly'); $this->assertSame($data['CommentText'], $comments->comment['CommentText'], '"Comment Text" was not set correctly'); }