Code Duplication    Length = 28-28 lines in 2 locations

Notifier/tests/Spec/Kreta/Notifier/Domain/Event/UserSignedUpSubscriberSpec.php 1 location

@@ 26-53 (lines=28) @@
23
use PhpSpec\ObjectBehavior;
24
use Prophecy\Argument;
25
26
class UserSignedUpSubscriberSpec extends ObjectBehavior
27
{
28
    function let(CommandBus $commandBus)
29
    {
30
        $this->beConstructedWith($commandBus);
31
    }
32
33
    function it_is_initializable()
34
    {
35
        $this->shouldHaveType(UserSignedUpSubscriber::class);
36
        $this->shouldHaveType(AsyncEventSubscriber::class);
37
    }
38
39
    function it_can_be_handle(AsyncDomainEvent $event, CommandBus $commandBus)
40
    {
41
        $event->values()->shouldBeCalled()->willReturn([
42
            'userId' => 'user-id',
43
        ]);
44
        $commandBus->handle(Argument::type(SignUpUserCommand::class))->shouldBeCalled();
45
        $this->handle($event);
46
    }
47
48
    function it_cannot_be_handle_when_values_does_not_contain_user_id(AsyncDomainEvent $event)
49
    {
50
        $event->values()->shouldBeCalled()->willReturn([]);
51
        $this->shouldThrow(AsyncDomainEventValueDoesNotExistException::class)->duringHandle($event);
52
    }
53
}
54

TaskManager/tests/Spec/Kreta/TaskManager/Domain/Event/User/UserRegisteredSubscriberSpec.php 1 location

@@ 26-53 (lines=28) @@
23
use PhpSpec\ObjectBehavior;
24
use Prophecy\Argument;
25
26
class UserRegisteredSubscriberSpec extends ObjectBehavior
27
{
28
    function let(CommandBus $commandBus)
29
    {
30
        $this->beConstructedWith($commandBus);
31
    }
32
33
    function it_is_initializable()
34
    {
35
        $this->shouldHaveType(UserRegisteredSubscriber::class);
36
        $this->shouldHaveType(AsyncEventSubscriber::class);
37
    }
38
39
    function it_can_be_handle(AsyncDomainEvent $event, CommandBus $commandBus)
40
    {
41
        $event->values()->shouldBeCalled()->willReturn([
42
            'userId' => 'user-id',
43
        ]);
44
        $commandBus->handle(Argument::type(AddUserCommand::class))->shouldBeCalled();
45
        $this->handle($event);
46
    }
47
48
    function it_cannot_be_handle_when_values_does_not_contain_user_id(AsyncDomainEvent $event)
49
    {
50
        $event->values()->shouldBeCalled()->willReturn([]);
51
        $this->shouldThrow(AsyncDomainEventValueDoesNotExistException::class)->duringHandle($event);
52
    }
53
}
54