|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Spec\Kreta\TaskManager\Application\Project\Task; |
|
4
|
|
|
|
|
5
|
|
|
use Kreta\TaskManager\Application\Project\Task\CreateTaskCommand; |
|
6
|
|
|
use PhpSpec\ObjectBehavior; |
|
7
|
|
|
use Prophecy\Argument; |
|
8
|
|
|
|
|
9
|
|
|
class CreateTaskCommandSpec extends ObjectBehavior |
|
10
|
|
|
{ |
|
11
|
|
|
function it_can_be_created_with_basic_info() |
|
12
|
|
|
{ |
|
13
|
|
|
$this->beConstructedWith( |
|
14
|
|
|
'title', |
|
15
|
|
|
'description', |
|
16
|
|
|
'creator-member-id', |
|
17
|
|
|
'creator-user-id', |
|
18
|
|
|
'assignee-member-id', |
|
19
|
|
|
'assignee-user-id', |
|
20
|
|
|
'priority', |
|
21
|
|
|
'project-id' |
|
22
|
|
|
); |
|
23
|
|
|
$this->shouldHaveType(CreateTaskCommand::class); |
|
24
|
|
|
$this->title()->shouldReturn('title'); |
|
25
|
|
|
$this->description()->shouldReturn('description'); |
|
26
|
|
|
$this->creatorMemberId()->shouldReturn('creator-member-id'); |
|
27
|
|
|
$this->creatorUserId()->shouldReturn('creator-user-id'); |
|
28
|
|
|
$this->assigneeMemberId()->shouldReturn('assignee-member-id'); |
|
29
|
|
|
$this->assigneeUserId()->shouldReturn('assignee-user-id'); |
|
30
|
|
|
$this->projectId()->shouldReturn('project-id'); |
|
31
|
|
|
$this->parentId()->shouldReturn(null); |
|
32
|
|
|
$this->taskId()->shouldReturn(null); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
View Code Duplication |
function it_can_be_created_with_basic_info_and_parent() |
|
|
|
|
|
|
36
|
|
|
{ |
|
37
|
|
|
$this->beConstructedWith( |
|
38
|
|
|
'title', |
|
39
|
|
|
'description', |
|
40
|
|
|
'creator-member-id', |
|
41
|
|
|
'creator-user-id', |
|
42
|
|
|
'assignee-member-id', |
|
43
|
|
|
'assignee-user-id', |
|
44
|
|
|
'priority', |
|
45
|
|
|
'project-id', |
|
46
|
|
|
'parent-id' |
|
47
|
|
|
); |
|
48
|
|
|
$this->title()->shouldReturn('title'); |
|
49
|
|
|
$this->description()->shouldReturn('description'); |
|
50
|
|
|
$this->creatorMemberId()->shouldReturn('creator-member-id'); |
|
51
|
|
|
$this->creatorUserId()->shouldReturn('creator-user-id'); |
|
52
|
|
|
$this->assigneeMemberId()->shouldReturn('assignee-member-id'); |
|
53
|
|
|
$this->assigneeUserId()->shouldReturn('assignee-user-id'); |
|
54
|
|
|
$this->projectId()->shouldReturn('project-id'); |
|
55
|
|
|
$this->parentId()->shouldReturn('parent-id'); |
|
56
|
|
|
$this->taskId()->shouldReturn(null); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
View Code Duplication |
function it_can_be_created_with_basic_info_and_parent_and_id() |
|
|
|
|
|
|
60
|
|
|
{ |
|
61
|
|
|
$this->beConstructedWith( |
|
62
|
|
|
'title', |
|
63
|
|
|
'description', |
|
64
|
|
|
'creator-member-id', |
|
65
|
|
|
'creator-user-id', |
|
66
|
|
|
'assignee-member-id', |
|
67
|
|
|
'assignee-user-id', |
|
68
|
|
|
'priority', |
|
69
|
|
|
'project-id', |
|
70
|
|
|
'parent-id', |
|
71
|
|
|
'task-id' |
|
72
|
|
|
); |
|
73
|
|
|
$this->title()->shouldReturn('title'); |
|
74
|
|
|
$this->description()->shouldReturn('description'); |
|
75
|
|
|
$this->creatorMemberId()->shouldReturn('creator-member-id'); |
|
76
|
|
|
$this->creatorUserId()->shouldReturn('creator-user-id'); |
|
77
|
|
|
$this->assigneeMemberId()->shouldReturn('assignee-member-id'); |
|
78
|
|
|
$this->assigneeUserId()->shouldReturn('assignee-user-id'); |
|
79
|
|
|
$this->projectId()->shouldReturn('project-id'); |
|
80
|
|
|
$this->parentId()->shouldReturn('parent-id'); |
|
81
|
|
|
$this->taskId()->shouldReturn('task-id'); |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.