| 1 | <?php |
||
| 18 | class CommentTest extends \PHPUnit_Framework_TestCase |
||
| 19 | { |
||
| 20 | public function testPublish() |
||
| 21 | { |
||
| 22 | $thread = new Thread('test', 1); |
||
| 23 | $comment = new Comment(CommentInterface::STATE_UNPUBLISHED, $thread); |
||
| 24 | |||
| 25 | $this->assertEquals(CommentInterface::STATE_UNPUBLISHED, $comment->getState()); |
||
| 26 | $this->assertFalse($comment->isPublished()); |
||
| 27 | $this->assertEquals(0, $thread->getCommentCount()); |
||
| 28 | |||
| 29 | $comment->publish(); |
||
| 30 | $this->assertEquals(CommentInterface::STATE_PUBLISHED, $comment->getState()); |
||
| 31 | $this->assertTrue($comment->isPublished()); |
||
| 32 | $this->assertEquals(1, $thread->getCommentCount()); |
||
| 33 | |||
| 34 | $comment->unpublish(); |
||
| 35 | $this->assertEquals(CommentInterface::STATE_UNPUBLISHED, $comment->getState()); |
||
| 36 | $this->assertFalse($comment->isPublished()); |
||
| 37 | $this->assertEquals(0, $thread->getCommentCount()); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |