Ejemplo n.º 1
0
 function it_removes_parent_task(ChangeParentTaskCommand $command, TaskRepository $repository, Task $task, ProjectId $projectId, ProjectRepository $projectRepository, Project $project, OrganizationRepository $organizationRepository, Organization $organization, OrganizationId $organizationId)
 {
     $command->id()->shouldBeCalled()->willReturn('task-id');
     $repository->taskOfId(TaskId::generate('task-id'))->shouldBeCalled()->willReturn($task);
     $command->parentId()->shouldBeCalled()->willReturn(null);
     $task->projectId()->shouldBeCalled()->willReturn($projectId);
     $projectRepository->projectOfId($projectId)->shouldBeCalled()->willReturn($project);
     $project->organizationId()->shouldBeCalled()->willReturn($organizationId);
     $organizationRepository->organizationOfId($organizationId)->shouldBeCalled()->willReturn($organization);
     $command->changerId()->shouldBeCalled()->willReturn('changer-id');
     $organization->isOrganizationMember(UserId::generate('changer-id'))->shouldBeCalled()->willReturn(true);
     $task->changeParent(null)->shouldBeCalled();
     $repository->persist($task)->shouldBeCalled();
     $this->__invoke($command);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 function it_edits_an_task(EditTaskCommand $command, TaskRepository $repository, Task $task, ProjectRepository $projectRepository, OrganizationRepository $organizationRepository, ProjectId $projectId, Project $project, OrganizationId $organizationId, Organization $organization)
 {
     $command->id()->shouldBeCalled()->willReturn('task-id');
     $repository->taskOfId(TaskId::generate('task-id'))->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);
     $command->editorId()->shouldBeCalled()->willReturn('editor-id');
     $organization->isOrganizationMember(UserId::generate('editor-id'))->shouldBeCalled()->willReturn(true);
     $command->title()->shouldBeCalled()->willReturn('Task title');
     $command->description()->shouldBeCalled()->willReturn('Task description');
     $task->edit(new TaskTitle('Task title'), 'Task description')->shouldBeCalled();
     $repository->persist(Argument::type(Task::class))->shouldBeCalled();
     $this->__invoke($command);
 }
Ejemplo n.º 4
0
 function it_handles_reassigning_task(OrganizationRepository $organizationRepository, ProjectRepository $projectRepository, TaskRepository $taskRepository, ReassignTaskCommand $command, Task $task, ProjectId $projectId, Project $project, OrganizationId $organizationId, Organization $organization, Member $member, MemberId $memberId)
 {
     $command->id()->shouldBeCalled()->willReturn('task-id');
     $command->assigneeId()->shouldBeCalled()->willReturn('new-assignee-id');
     $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);
     $organization->isOrganizationMember(UserId::generate('new-assignee-id'))->shouldBeCalled()->willReturn(true);
     $organization->organizationMember(UserId::generate('new-assignee-id'))->shouldBeCalled()->willReturn($member);
     $member->id()->shouldBeCalled()->willReturn($memberId);
     $task->reassign(Argument::type(MemberId::class))->shouldBeCalled();
     $taskRepository->persist($task)->shouldBeCalled();
     $this->__invoke($command);
 }
Ejemplo n.º 5
0
 function it_creates_an_organization_without_parent_task(CreateTaskCommand $command, TaskRepository $repository, ProjectRepository $projectRepository, OrganizationRepository $organizationRepository, Project $project, OrganizationId $organizationId, Organization $organization, ProjectId $projectId, Member $member, Member $member2, MemberId $memberId, MemberId $memberId2)
 {
     $command->projectId()->shouldBeCalled()->willReturn('project-id');
     $command->taskId()->shouldBeCalled()->willReturn('task-id');
     $command->parentId()->shouldBeCalled()->willReturn(null);
     $repository->taskOfId(TaskId::generate('task-id'))->shouldBeCalled()->willReturn(null);
     $projectRepository->projectOfId(ProjectId::generate('project-id'))->shouldBeCalled()->willReturn($project);
     $project->organizationId()->shouldBeCalled()->willReturn($organizationId);
     $organizationRepository->organizationOfId($organizationId)->shouldBeCalled()->willReturn($organization);
     $command->creatorId()->shouldBeCalled()->willReturn('creator-id');
     $command->assigneeId()->shouldBeCalled()->willReturn('assignee-id');
     $organization->isOrganizationMember(UserId::generate('creator-id'))->shouldBeCalled()->willReturn(true);
     $organization->isOrganizationMember(UserId::generate('assignee-id'))->shouldBeCalled()->willReturn(true);
     $organization->organizationMember(UserId::generate('creator-id'))->shouldBeCalled()->willReturn($member);
     $member->id()->shouldBeCalled()->willReturn($memberId);
     $organization->organizationMember(UserId::generate('assignee-id'))->shouldBeCalled()->willReturn($member2);
     $member2->id()->shouldBeCalled()->willReturn($memberId2);
     $command->title()->shouldBeCalled()->willReturn('Task title');
     $command->description()->shouldBeCalled()->willReturn('Task description');
     $command->priority()->shouldBeCalled()->willReturn('low');
     $project->id()->shouldBeCalled()->willReturn($projectId);
     $repository->persist(Argument::type(Task::class))->shouldBeCalled();
     $this->__invoke($command);
 }