Esempio n. 1
0
 public function __invoke(OrganizationOfIdQuery $query)
 {
     $organization = $this->repository->organizationOfId(OrganizationId::generate($query->organizationId()));
     if (!$organization instanceof Organization) {
         throw new OrganizationDoesNotExistException();
     }
     $this->dataTransformer->write($organization);
     return $this->dataTransformer->read();
 }
 function it_does_not_serialize_organization_because_the_organization_does_not_exist(OrganizationOfIdQuery $query, OrganizationRepository $repository)
 {
     $query->organizationId()->shouldBeCalled()->willReturn('organization-id');
     $repository->organizationOfId(OrganizationId::generate('organization-id'))->shouldBeCalled()->willReturn(null);
     $this->shouldThrow(OrganizationDoesNotExistException::class)->during__invoke($query);
 }