-
Notifications
You must be signed in to change notification settings - Fork 15
/
UntagPostHandlerTest.php
98 lines (87 loc) · 2.93 KB
/
UntagPostHandlerTest.php
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace SuperAwesome\Blog\Domain\Model\Post\Adapter\Broadway\Command\Handler;
use SuperAwesome\Blog\Domain\Model\Post\Command\UntagPost;
use SuperAwesome\Blog\Domain\Model\Post\Event\PostWasCategorized;
use SuperAwesome\Blog\Domain\Model\Post\Event\PostWasCreated;
use SuperAwesome\Blog\Domain\Model\Post\Event\PostWasPublished;
use SuperAwesome\Blog\Domain\Model\Post\Event\PostWasTagged;
use SuperAwesome\Blog\Domain\Model\Post\Event\PostWasUntagged;
class UntagPostHandlerTest extends AbstractPostHandlerTest
{
/*
public function setUp()
{
$this->markTestIncomplete('Post is not an EventSourcedAggregateRoot.');
}
*/
/** @test */
public function it_can_untag()
{
//$this->markTestIncomplete('Post::instantiateForReconstitution does not exist.');
$id = 'my-id';
$title = 'the title';
$content = 'the content';
$category = 'draft';
$es = 'es';
$cqrs = 'cqrs';
$broadway = 'broadway';
$this->scenario
->withAggregateId($id)
->given([
new PostWasCreated($id),
new PostWasCategorized($id, $category),
new PostWasPublished($id, $title, $content, $category),
new PostWasTagged($id, $es),
new PostWasTagged($id, $cqrs),
new PostWasTagged($id, $broadway),
])
->when(new UntagPost($id, $es))
->then([
new PostWasUntagged($id, $es),
])
->when(new UntagPost($id, $cqrs))
->then([
new PostWasUntagged($id, $cqrs),
])
->when(new UntagPost($id, $broadway))
->then([
new PostWasUntagged($id, $broadway),
])
;
}
/** @test */
public function it_does_not_untag_again()
{
$this->markTestIncomplete('Post::instantiateForReconstitution does not exist.');
$id = 'my-id';
$title = 'the title';
$content = 'the content';
$category = 'draft';
$es = 'es';
$cqrs = 'cqrs';
$broadway = 'broadway';
$this->scenario
->withAggregateId($id)
->given([
new PostWasCreated($id),
new PostWasCategorized($id, $category),
new PostWasPublished($id, $title, $content, $category),
new PostWasTagged($id, $es),
new PostWasTagged($id, $cqrs),
new PostWasTagged($id, $broadway),
new PostWasUntagged($id, $es),
new PostWasUntagged($id, $broadway),
])
->when(new UntagPost($id, $es))
->then([
])
->when(new UntagPost($id, $cqrs))
->then([
new PostWasUntagged($id, $cqrs),
])
->when(new UntagPost($id, $broadway))
->then([
])
;
}
}