SetLastCommentWhenCommentPostedTest.php
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace FootyRoom\Tests\Integration\ForumPost;
use FootyRoom\Core\Comment\Author;
use FootyRoom\Core\Comment\Comment;
use FootyRoom\Core\ForumPost\ForumPostCommentPosted;
use FootyRoom\Core\ForumPost\SetLastCommentWhenCommentPosted;
use FootyRoom\Core\ForumPost\ForumPost;
use FootyRoom\Queries\PostQuery;
use FootyRoom\Tests\TestCase;
class SetLastCommentWhenCommentPostedTest extends TestCase
{
public function setup()
{
$this->mockPostQuery = $this->getMockBuilder(PostQuery::class)
->disableOriginalConstructor()
->getMock();
$this->setLastCommentWhenCommentPosted = new SetLastCommentWhenCommentPosted($this->mockPostQuery);
}
public function testUpdateLastCommentWasCalled()
{
$discussionId = 'forumPost:1';
$author = new Author(41301, 'chanBC');
$content = 'test content';
$html = '';
$comment = new Comment(
$discussionId,
$author,
$content,
$html
);
$post = new ForumPost('title', 1, 1);
$commentPosted = new ForumPostCommentPosted($comment, $post);
$this->mockPostQuery->expects($this->once())
->method('updateLastComment');
$this->setLastCommentWhenCommentPosted->handle($commentPosted);
}
}