Code Duplication    Length = 12-14 lines in 2 locations

src/Kreta/TaskManager/Tests/Spec/Kreta/TaskManager/Application/Project/Task/ChangeParentTaskHandlerSpec.php 1 location

@@ 120-133 (lines=14) @@
117
        $this->shouldThrow(TaskDoesNotExistException::class)->during__invoke($command);
118
    }
119
120
    function it_does_not_change_parent_task_because_task_and_parent_task_are_the_same(
121
        ChangeParentTaskCommand $command,
122
        TaskRepository $repository,
123
        Task $task,
124
        TaskId $taskId
125
    ) {
126
        $command->id()->shouldBeCalled()->willReturn('task-id');
127
        $repository->taskOfId(TaskId::generate('task-id'))->shouldBeCalled()->willReturn($task);
128
        $command->parentId()->shouldBeCalled()->willReturn('task-id');
129
        $task->id()->shouldBeCalled()->willReturn($taskId);
130
        $taskId->equals(TaskId::generate('task-id'))->shouldBeCalled()->willReturn(true);
131
132
        $this->shouldThrow(TaskAndTaskParentCannotBeTheSameException::class)->during__invoke($command);
133
    }
134
135
    function it_does_not_change_parent_task_because_parent_task_does_not_exist(
136
        ChangeParentTaskCommand $command,

src/Kreta/TaskManager/Tests/Spec/Kreta/TaskManager/Application/Project/Task/CreateTaskHandlerSpec.php 1 location

@@ 159-170 (lines=12) @@
156
        $this->shouldThrow(TaskAlreadyExistsException::class)->during__invoke($command);
157
    }
158
159
    function it_does_not_create_a_task_because_project_does_not_exist(
160
        CreateTaskCommand $command,
161
        TaskRepository $repository,
162
        ProjectRepository $projectRepository
163
    ) {
164
        $command->projectId()->shouldBeCalled()->willReturn('project-id');
165
        $command->taskId()->shouldBeCalled()->willReturn('task-id');
166
        $command->parentId()->shouldBeCalled()->willReturn(null);
167
        $repository->taskOfId(TaskId::generate('task-id'))->shouldBeCalled()->willReturn(null);
168
        $projectRepository->projectOfId(ProjectId::generate('project-id'))->shouldBeCalled()->willReturn(null);
169
        $this->shouldThrow(ProjectDoesNotExistException::class)->during__invoke($command);
170
    }
171
172
    function it_does_not_create_a_task_because_task_creation_is_not_allowed(
173
        CreateTaskCommand $command,