UserIncrementPostCountWhenForumPostPostedTest.php
1.22 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
<?php
namespace FootyRoom\Tests\Integration\User;
use FootyRoom\Core\ForumPost\ForumPostPosted;
use FootyRoom\Core\ForumPost\ForumPost;
use FootyRoom\Core\User\IncrementPostCountWhenForumPostPosted;
use FootyRoom\Repositories\UserRepository;
use FootyRoom\Tests\TestCase;
class UserIncrementPostCountWhenForumPostPostedTest extends TestCase
{
public function setup()
{
$this->mockUserRepository = $this->getMockBuilder(UserRepository::class)
->disableOriginalConstructor()
->getMock();
$this->incrementPostCountWhenForumPostPosted = new IncrementPostCountWhenForumPostPosted(
$this->mockUserRepository
);
}
public function testIncrementPostCountWasCalled()
{
$title = 'title';
$newCategoryId = 61;
$userId = 41301;
$forumPost = new ForumPost(
$title,
$newCategoryId,
$userId
);
$forumPostPosted = new ForumPostPosted($forumPost);
$this->mockUserRepository->expects($this->once())
->method('incrementPostCount');
$this->incrementPostCountWhenForumPostPosted->handle($forumPostPosted);
}
}