Пример #1
0
 public function testAllArticle()
 {
     $this->modelArticle = new CommentsArticleModel();
     $state = $this->modelArticle->insertCommentArticle(1, 87, 'Trop SWAG');
     $this->assertEquals(true, $state);
     $state = $this->modelArticle->getCommentsForArticle(87);
     $this->assertNotEmpty($state);
     $state = $this->modelArticle->deleteCommentArticle(0);
     $this->assertEquals(true, $state);
 }
Пример #2
0
 public function show()
 {
     $id = (int) $this->getParams()[0];
     $article = $this->articleModel->getOneNewsById($id);
     if (empty($article)) {
         throw new NewsNotFoundException($id);
     }
     $article = $this->getInfos($article);
     $comments = $this->articleCommentModel->getCommentsForArticle($id);
     $this->getView()->render('article/show', ['article' => $article, 'comments' => $comments]);
 }