function it_handles_task_priority_change(OrganizationRepository $organizationRepository, ProjectRepository $projectRepository, TaskRepository $taskRepository, ChangeTaskProgressCommand $command, Task $task, Project $project, ProjectId $projectId, OrganizationId $organizationId, Organization $organization)
 {
     $command->id()->shouldBeCalled()->willReturn('task-id');
     $command->progress()->shouldBeCalled()->willReturn('doing');
     $command->editorId()->shouldBeCalled()->willReturn('editor-id');
     $taskRepository->taskOfId(Argument::type(TaskId::class))->shouldBeCalled()->willReturn($task);
     $task->projectId()->shouldBeCalled()->willReturn($projectId);
     $projectRepository->projectOfId($projectId)->shouldBeCalled()->willReturn($project);
     $project->organizationId()->shouldBeCalled()->willReturn($organizationId);
     $organizationRepository->organizationOfId($organizationId)->shouldBeCalled()->willReturn($organization);
     $organization->isOrganizationMember(UserId::generate('editor-id'))->shouldBeCalled()->willReturn(true);
     $task->changeProgress(Argument::type(TaskProgress::class))->shouldBeCalled();
     $taskRepository->persist(Argument::type(Task::class))->shouldBeCalled();
     $this->__invoke($command);
 }
 public function __invoke(ChangeTaskProgressCommand $command)
 {
     $task = $this->taskRepository->taskOfId(TaskId::generate($command->id()));
     if (!$task instanceof Task) {
         throw new TaskDoesNotExistException();
     }
     $project = $this->projectRepository->projectOfId($task->projectId());
     if (!$project instanceof Project) {
         throw new ProjectDoesNotExistException();
     }
     $organization = $this->organizationRepository->organizationOfId($project->organizationId());
     if (!$organization instanceof Organization) {
         throw new OrganizationDoesNotExistException();
     }
     if (!$organization->isOrganizationMember(UserId::generate($command->editorId()))) {
         throw new UnauthorizedTaskActionException();
     }
     $task->changeProgress(new TaskProgress($command->progress()));
     $this->taskRepository->persist($task);
 }