Beispiel #1
0
 function it_serializes_project(ProjectOfIdQuery $query, ProjectRepository $repository, Project $project, OrganizationId $organizationId, OrganizationRepository $organizationRepository, Organization $organization, ProjectDataTransformer $dataTransformer)
 {
     $query->projectId()->shouldBeCalled()->willReturn('project-id');
     $repository->projectOfId(ProjectId::generate('project-id'))->shouldBeCalled()->willReturn($project);
     $project->organizationId()->shouldBeCalled()->willReturn($organizationId);
     $organizationRepository->organizationOfId($organizationId)->shouldBeCalled()->willReturn($organization);
     $query->userId()->shouldBeCalled()->willReturn('user-id');
     $organization->isOrganizationMember(UserId::generate('user-id'))->shouldBeCalled()->willReturn(true);
     $dataTransformer->write($project)->shouldBeCalled();
     $dataTransformer->read()->shouldBeCalled();
     $this->__invoke($query);
 }
 function it_serializes_filtered_projects_without_project_name(FilterProjectsQuery $query, ProjectRepository $repository, Project $project, ProjectDataTransformer $dataTransformer)
 {
     $query->userId()->shouldBeCalled()->willReturn('user-id');
     $query->organizationId()->shouldBeCalled()->willReturn('organization-id');
     $query->name()->shouldBeCalled()->willReturn(null);
     $query->offset()->shouldBeCalled()->willReturn(0);
     $query->limit()->shouldBeCalled()->willReturn(-1);
     $repository->query(Argument::any())->shouldBeCalled()->willReturn([$project]);
     $dataTransformer->write($project)->shouldBeCalled();
     $dataTransformer->read()->shouldBeCalled();
     $this->__invoke($query)->shouldBeArray();
 }