public function it_resolves_tenant_from_default_root_host($tenantRepository, TenantInterface $tenant) { $tenant->getId()->willReturn(1); $tenant->getSubdomain()->willReturn('default'); $tenant->getName()->willReturn('default'); $tenantRepository->findOneBySubdomain('default')->shouldBeCalled()->willReturn($tenant); $this->resolve('domain.com')->shouldReturn($tenant); }
public function it_should_get_tenant(TenantInterface $tenant) { $tenant->getId()->willReturn(1); $tenant->getSubdomain()->willReturn('example1'); $tenant->getName()->willReturn('example1'); $this->setTenant($tenant)->shouldBeNull(); $this->getTenant()->shouldEqual($tenant); }
public function it_should_return_global_variables(TenantInterface $tenant, TenantContextInterface $tenantContext) { $tenant->getSubdomain()->willReturn('example'); $tenant->getName()->willReturn('example tenant'); $tenantContext->getTenant()->shouldBeCalled()->willReturn($tenant); $globals = ['tenant' => $tenant]; $this->getGlobals()->shouldReturn($globals); }
public function it_throws_an_exception(FactoryInterface $factory, GeneratorInterface $generator, TenantInterface $tenant, OrganizationInterface $organization, OrganizationRepositoryInterface $organizationRepository) { $organizationRepository->findOneByCode('123456')->willReturn(null); $factory->create()->shouldNotBeCalled(); $generator->generate(6)->shouldNotBeCalled(); $tenant->setCode('123456')->shouldNotBeCalled(); $tenant->setOrganization($organization)->shouldNotBeCalled(); $this->shouldThrow(\InvalidArgumentException::class)->during('createForOrganization', ['123456']); }
private function assignDefaultOrganization(TenantInterface $tenant) { if (null === $tenant->getOrganization()) { $organization = $this->get('swp.repository.organization')->findOneByName(OrganizationInterface::DEFAULT_NAME); if (null === $organization) { throw $this->createNotFoundException('Default organization was not found.'); } $tenant->setOrganization($organization); } return $tenant; }