UnnotifyWhenCommentRemovedTest.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\Notification;
use FootyRoom\Core\Comment\Author;
use FootyRoom\Core\Comment\Comment;
use FootyRoom\Core\Comment\CommentRemoved;
use FootyRoom\Core\Notification\UnnotifyWhenCommentRemoved;
use FootyRoom\Support\SqlCommentNotifier;
use FootyRoom\Tests\TestCase;
class UnnotifyWhenCommentRemovedTest extends TestCase
{
public function setUp()
{
$this->mockSqlCommentNotifier = $this->getMockBuilder(SqlCommentNotifier::class)
->disableOriginalConstructor()
->setMethods([
'unnotify',
])
->getMock();
$this->unnotifyWhenCommentRemoved = new UnnotifyWhenCommentRemoved($this->mockSqlCommentNotifier);
}
public function testUnnotifyWasCalled()
{
$postId = 1;
$author = new Author(41301, 'chanBC');
$content = 'test content';
$html = '';
$comment = new Comment(
$postId,
$author,
$content,
$html
);
$commentRemoved = new CommentRemoved($comment);
$this->mockSqlCommentNotifier->expects($this->once())
->method('unnotify');
$this->unnotifyWhenCommentRemoved->handle($commentRemoved);
}
}