@@ 20-41 (lines=22) @@ | ||
17 | use Kreta\TaskManager\Application\Command\Organization\EditOrganizationCommand; |
|
18 | use PhpSpec\ObjectBehavior; |
|
19 | ||
20 | class EditOrganizationCommandSpec extends ObjectBehavior |
|
21 | { |
|
22 | function it_can_be_created_with_basic_info() |
|
23 | { |
|
24 | $this->beConstructedWith('organization-id', 'Organization name', 'user-id'); |
|
25 | $this->shouldHaveType(EditOrganizationCommand::class); |
|
26 | $this->id()->shouldReturn('organization-id'); |
|
27 | $this->name()->shouldReturn('Organization name'); |
|
28 | $this->editorId()->shouldReturn('user-id'); |
|
29 | $this->slug()->shouldReturn(null); |
|
30 | } |
|
31 | ||
32 | function it_can_be_created_with_basic_info_and_slug() |
|
33 | { |
|
34 | $this->beConstructedWith('organization-id', 'Organization name', 'user-id', 'organization-slug'); |
|
35 | $this->shouldHaveType(EditOrganizationCommand::class); |
|
36 | $this->id()->shouldReturn('organization-id'); |
|
37 | $this->name()->shouldReturn('Organization name'); |
|
38 | $this->editorId()->shouldReturn('user-id'); |
|
39 | $this->slug()->shouldReturn('organization-slug'); |
|
40 | } |
|
41 | } |
|
42 |
@@ 20-46 (lines=27) @@ | ||
17 | use Kreta\TaskManager\Application\Command\Project\EditProjectCommand; |
|
18 | use PhpSpec\ObjectBehavior; |
|
19 | ||
20 | class EditProjectCommandSpec extends ObjectBehavior |
|
21 | { |
|
22 | function let() |
|
23 | { |
|
24 | $this->beConstructedWith('project-id', 'Project name', 'editor-id', 'project-name'); |
|
25 | } |
|
26 | ||
27 | function it_can_be_created() |
|
28 | { |
|
29 | $this->shouldHaveType(EditProjectCommand::class); |
|
30 | ||
31 | $this->id()->shouldReturn('project-id'); |
|
32 | $this->name()->shouldReturn('Project name'); |
|
33 | $this->editorId()->shouldReturn('editor-id'); |
|
34 | $this->slug()->shouldReturn('project-name'); |
|
35 | } |
|
36 | ||
37 | function it_can_be_created_without_a_slug() |
|
38 | { |
|
39 | $this->beConstructedWith('project-id', 'Project name', 'editor-id'); |
|
40 | ||
41 | $this->id()->shouldReturn('project-id'); |
|
42 | $this->name()->shouldReturn('Project name'); |
|
43 | $this->editorId()->shouldReturn('editor-id'); |
|
44 | $this->slug()->shouldReturn(null); |
|
45 | } |
|
46 | } |
|
47 |
@@ 20-41 (lines=22) @@ | ||
17 | use Kreta\Notifier\Application\Inbox\Notification\ViewUserNotificationsQuery; |
|
18 | use PhpSpec\ObjectBehavior; |
|
19 | ||
20 | class ViewUserNotificationsQuerySpec extends ObjectBehavior |
|
21 | { |
|
22 | function it_can_be_created() |
|
23 | { |
|
24 | $this->beConstructedWith('user-id', 0, 10); |
|
25 | $this->shouldHaveType(ViewUserNotificationsQuery::class); |
|
26 | $this->userId()->shouldReturn('user-id'); |
|
27 | $this->offset()->shouldReturn(0); |
|
28 | $this->limit()->shouldReturn(10); |
|
29 | $this->status()->shouldReturn(null); |
|
30 | } |
|
31 | ||
32 | function it_can_be_created_with_status() |
|
33 | { |
|
34 | $this->beConstructedWith('user-id', 0, 10, 'read'); |
|
35 | $this->shouldHaveType(ViewUserNotificationsQuery::class); |
|
36 | $this->userId()->shouldReturn('user-id'); |
|
37 | $this->offset()->shouldReturn(0); |
|
38 | $this->limit()->shouldReturn(10); |
|
39 | $this->status()->shouldReturn('read'); |
|
40 | } |
|
41 | } |
|
42 |
@@ 20-41 (lines=22) @@ | ||
17 | use Kreta\Notifier\Application\Inbox\Notification\PublishNotificationCommand; |
|
18 | use PhpSpec\ObjectBehavior; |
|
19 | ||
20 | class PublishNotificationCommandSpec extends ObjectBehavior |
|
21 | { |
|
22 | function it_can_be_created() |
|
23 | { |
|
24 | $this->beConstructedWith('project_created', 'The notification body', 'user-id', 'notification-id'); |
|
25 | $this->shouldHaveType(PublishNotificationCommand::class); |
|
26 | $this->notificationId()->shouldReturn('notification-id'); |
|
27 | $this->type()->shouldReturn('project_created'); |
|
28 | $this->body()->shouldReturn('The notification body'); |
|
29 | $this->userId()->shouldReturn('user-id'); |
|
30 | } |
|
31 | ||
32 | function it_can_be_created_without_notification_id() |
|
33 | { |
|
34 | $this->beConstructedWith('project_created', 'The notification body', 'user-id'); |
|
35 | $this->shouldHaveType(PublishNotificationCommand::class); |
|
36 | $this->notificationId()->shouldNotReturn(null); |
|
37 | $this->type()->shouldReturn('project_created'); |
|
38 | $this->body()->shouldReturn('The notification body'); |
|
39 | $this->userId()->shouldReturn('user-id'); |
|
40 | } |
|
41 | } |
|
42 |