public function testAddCommentToImage()
 {
     $image = $this->imageService->getRandomImage();
     $comment = new Comment();
     $comment->comment = $this->faker->text(rand(100, 500));
     $comment->created_user_id = $this->randomCommentPoolUser()->user_id;
     $this->assertTrue($this->commentService->addCommentToImage($comment, $image) instanceof ImageCommentLink);
     $this->assertEquals(1, count($this->commentService->getComments($image)));
 }
Beispiel #2
0
 /**
  * @depends testCreateThreads
  * @param $threads
  * @returns array Array of Arrays of comments.
  */
 public function testCreateComments($threads)
 {
     $comments = [];
     foreach ($threads as $threadId => $thread) {
         $count = rand(1, 15);
         for ($i = 1; $i <= $count; $i++) {
             $user = $this->randomBoardPoolUser();
             $comment = $this->commentService->addCommentToThread($thread, $user, implode("\n\n", $this->faker->paragraphs(rand(1, 5))));
             $this->assertTrue($comment instanceof Models\Comment);
             $comments[$threadId][$i] = $comment;
         }
     }
     return $comments;
 }