|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Kreta package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Beñat Espiña <[email protected]> |
|
7
|
|
|
* (c) Gorka Laucirica <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Spec\Kreta\TaskManager\Domain\Model\Project\Task; |
|
14
|
|
|
|
|
15
|
|
|
use Kreta\SharedKernel\Domain\Model\DomainEvent; |
|
16
|
|
|
use Kreta\TaskManager\Domain\Model\Organization\Participant; |
|
17
|
|
|
use Kreta\TaskManager\Domain\Model\Project\Task\TaskCreated; |
|
18
|
|
|
use Kreta\TaskManager\Domain\Model\Project\Task\TaskId; |
|
19
|
|
|
use Kreta\TaskManager\Domain\Model\Project\Task\TaskPriority; |
|
20
|
|
|
use Kreta\TaskManager\Domain\Model\Project\Task\TaskTitle; |
|
21
|
|
|
use PhpSpec\ObjectBehavior; |
|
22
|
|
|
|
|
23
|
|
|
class TaskCreatedSpec extends ObjectBehavior |
|
24
|
|
|
{ |
|
25
|
|
|
function let( |
|
26
|
|
|
TaskId $taskId, |
|
27
|
|
|
TaskTitle $title, |
|
28
|
|
|
Participant $creator, |
|
29
|
|
|
Participant $assignee, |
|
30
|
|
|
TaskPriority $priority, |
|
31
|
|
|
TaskId $parentId) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->beConstructedWith($taskId, $title, 'Description', $creator, $assignee, $priority, $parentId); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function it_creates_a_task_created_event( |
|
37
|
|
|
TaskId $taskId, |
|
38
|
|
|
TaskTitle $title, |
|
39
|
|
|
Participant $creator, |
|
40
|
|
|
Participant $assignee, |
|
41
|
|
|
TaskPriority $priority, |
|
42
|
|
|
TaskId $parentId) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->shouldHaveType(TaskCreated::class); |
|
45
|
|
|
$this->shouldImplement(DomainEvent::class); |
|
46
|
|
|
|
|
47
|
|
|
$this->id()->shouldReturn($taskId); |
|
48
|
|
|
$this->title()->shouldReturn($title); |
|
49
|
|
|
$this->description()->shouldReturn('Description'); |
|
50
|
|
|
$this->creator()->shouldReturn($creator); |
|
51
|
|
|
$this->assignee()->shouldReturn($assignee); |
|
52
|
|
|
$this->priority()->shouldReturn($priority); |
|
53
|
|
|
$this->parentId()->shouldReturn($parentId); |
|
54
|
|
|
$this->occurredOn()->shouldReturnAnInstanceOf(\DateTimeInterface::class); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|