public function let(TenantContextInterface $tenantContext) { $currentTenant = new Tenant(); $currentTenant->setName('Default'); $currentTenant->setSubdomain('default'); $tenantContext->getTenant()->willReturn($currentTenant); $this->beConstructedWith($tenantContext, '/swp'); }
public function let(TenantContextInterface $tenantContext) { $currentTenant = new Tenant(); $currentTenant->setName('Default'); $currentTenant->setSubdomain('default'); $currentTenant->setCode(654321); $organization = new Organization(); $organization->setCode(123456); $currentTenant->setOrganization($organization); $tenantContext->getTenant()->willReturn($currentTenant); $this->beConstructedWith($tenantContext, '/swp'); }
public function it_sets_the_tenant_code_on_pre_persist_doctrine_event(TenantContextInterface $tenantContext, LifecycleEventArgs $event, TenantAwareInterface $tenantAware, ContainerInterface $container) { $tenant = new Tenant(); $tenant->setSubdomain('example.com'); $tenant->setName('Example'); $tenant->setCode('123456'); $tenantAware->getTenantCode()->shouldBeCalled()->willReturn(null); $event->getEntity()->willReturn($tenantAware); $tenantContext->getTenant()->shouldBeCalled()->willReturn($tenant); $tenantAware->setTenantCode('123456')->shouldBeCalled(); $container->get('swp_multi_tenancy.tenant_context')->willReturn($tenantContext); $this->prePersist($event)->shouldBeNull(); }