function it_does_not_remove_organization_member_to_organization_because_it_is_not_allowed(RemoveOrganizationMemberToOrganizationCommand $command, OrganizationRepository $repository, Organization $organization)
 {
     $organizationId = OrganizationId::generate('organization-id');
     $command->organizationId()->shouldBeCalled()->willReturn('organization-id');
     $repository->organizationOfId($organizationId)->shouldBeCalled()->willReturn($organization);
     $command->removerId()->shouldBeCalled()->willReturn('remover-id');
     $organization->isOwner(UserId::generate('remover-id'))->shouldBeCalled()->willReturn(false);
     $this->shouldThrow(UnauthorizedOrganizationActionException::class)->during__invoke($command);
 }
 public function __invoke(RemoveOrganizationMemberToOrganizationCommand $command)
 {
     $organization = $this->repository->organizationOfId(OrganizationId::generate($command->organizationId()));
     if (!$organization instanceof Organization) {
         throw new OrganizationDoesNotExistException();
     }
     if (!$organization->isOwner(UserId::generate($command->removerId()))) {
         throw new UnauthorizedOrganizationActionException();
     }
     $organization->removeOrganizationMember(UserId::generate($command->userId()));
     $this->repository->persist($organization);
 }