public function testGetters()
 {
     // Given
     $thread = new BaseThread();
     $thread->setId('my-comment-thread');
     $comment = new BaseComment();
     $comment->setBody('Comment text');
     $comment->setWebsite('http://www.example.com');
     $comment->setEmail('*****@*****.**');
     $comment->setNote(0.2);
     $comment->setPrivate(true);
     $comment->setAuthorName('My name');
     $date = new \DateTime();
     $comment->setCreatedAt($date);
     $comment->setState(1);
     $comment->setThread($thread);
     // Then
     $this->assertEquals('Comment text', $comment->getBody(), 'Should return correct comment body');
     $this->assertEquals('http://www.example.com', $comment->getWebsite(), 'Should return correct comment author website');
     $this->assertEquals('*****@*****.**', $comment->getEmail(), 'Should return correct comment author email address');
     $this->assertEquals(0.2, $comment->getNote(), 'Should return correct comment note');
     $this->assertTrue($comment->isPrivate(), 'Should return that comment is flagged as private');
     $this->assertEquals('My name', $comment->getAuthorName(), 'Should return correct comment author name');
     $this->assertEquals($date, $comment->getCreatedAt(), 'Should return correct creation date');
     $this->assertEquals($thread, $comment->getThread(), 'Should return correct thread');
     $this->assertEquals('my-comment-thread', $comment->getThread()->getId(), 'Should return correct thread identifier');
 }
Exemplo n.º 2
0
 public function testGetters()
 {
     // Given
     $thread = new BaseThread();
     $thread->setId('my-comment-thread');
     $thread->setCommentable(true);
     $lastCommentDate = new \DateTime();
     $thread->setLastCommentAt($lastCommentDate);
     $thread->setNumComments(5);
     $thread->setPermalink('my-custom-permalink');
     // Then
     $this->assertEquals('my-comment-thread', $thread->getId(), 'Should return correct thread identifier');
     $this->assertEquals(true, $thread->getIsCommentable(), 'Should return if thread is commentable');
     $this->assertEquals($lastCommentDate, $thread->getLastCommentAt(), 'Should return correct last commented date');
     $this->assertEquals(5, $thread->getNumComments(), 'Should return correct number of comments');
     $this->assertEquals('my-custom-permalink', $thread->getPermalink(), 'Should return correct thread permalink');
 }