public function testComment()
 {
     $dto = new WriteCommentDTO();
     $dto->setContent('wat!')->setUser($user = User::fromDTO(new CreateUserDTO('Ma27', '123456', '*****@*****.**')));
     $comment = Comment::fill($dto);
     $comment->setEventDispatcher(new EventDispatcher());
     $comment->publish();
     $this->assertInstanceOf(\DateTime::class, $comment->getCreationDate());
     $this->assertSame('wat!', $comment->getContent());
     $this->assertSame($user, $comment->getAuthor());
 }
Exemplo n.º 2
0
 /**
  * Fills the comment
  *
  * @param WriteCommentDTO $data
  *
  * @return Comment
  */
 public static function fill(WriteCommentDTO $data)
 {
     return new self($data->getUser(), $data->getContent());
 }