Code Duplication    Length = 7-10 lines in 2 locations

TaskManager/tests/Spec/Kreta/TaskManager/Application/Command/User/AddUserHandlerSpec.php 2 locations

@@ 36-42 (lines=7) @@
33
        $this->shouldHaveType(AddUserHandler::class);
34
    }
35
36
    function it_adds_user(AddUserCommand $command, UserRepository $repository)
37
    {
38
        $command->userId()->shouldBeCalled()->willReturn('user-id');
39
        $repository->userOfId(UserId::generate('user-id'))->shouldBeCalled()->willReturn(null);
40
        $repository->persist(Argument::type(User::class))->shouldBeCalled();
41
        $this->__invoke($command);
42
    }
43
44
    function it_does_not_add_user_when_the_user_already_exists(
45
        AddUserCommand $command,
@@ 44-53 (lines=10) @@
41
        $this->__invoke($command);
42
    }
43
44
    function it_does_not_add_user_when_the_user_already_exists(
45
        AddUserCommand $command,
46
        UserRepository $repository,
47
        User $user
48
    ) {
49
        $command->userId()->shouldBeCalled()->willReturn('user-id');
50
        $repository->userOfId(UserId::generate('user-id'))->shouldBeCalled()->willReturn($user);
51
        $user->id()->shouldBeCalled()->willReturn(UserId::generate('user-id'));
52
        $this->shouldThrow(UserAlreadyExistsException::class)->during__invoke($command);
53
    }
54
}
55