|
@@ 37-48 (lines=12) @@
|
| 34 |
|
$this->shouldImplement('SWP\Component\MultiTenancy\Resolver\TenantResolverInterface'); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
public function it_resolves_tenant_from_subdomain($tenantRepository, TenantInterface $tenant) |
| 38 |
|
{ |
| 39 |
|
$tenant->getId()->willReturn(1); |
| 40 |
|
$tenant->getSubdomain()->willReturn('example1'); |
| 41 |
|
$tenant->getName()->willReturn('example1'); |
| 42 |
|
|
| 43 |
|
$tenantRepository->findBySubdomain('example1') |
| 44 |
|
->shouldBeCalled() |
| 45 |
|
->willReturn($tenant); |
| 46 |
|
|
| 47 |
|
$this->resolve('example1.domain.com')->shouldReturn($tenant); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
public function it_resolves_tenant_from_default_root_host($tenantRepository, TenantInterface $tenant) |
| 51 |
|
{ |
|
@@ 50-61 (lines=12) @@
|
| 47 |
|
$this->resolve('example1.domain.com')->shouldReturn($tenant); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
public function it_resolves_tenant_from_default_root_host($tenantRepository, TenantInterface $tenant) |
| 51 |
|
{ |
| 52 |
|
$tenant->getId()->willReturn(1); |
| 53 |
|
$tenant->getSubdomain()->willReturn('default'); |
| 54 |
|
$tenant->getName()->willReturn('default'); |
| 55 |
|
|
| 56 |
|
$tenantRepository->findBySubdomain('default') |
| 57 |
|
->shouldBeCalled() |
| 58 |
|
->willReturn($tenant); |
| 59 |
|
|
| 60 |
|
$this->resolve('domain.com')->shouldReturn($tenant); |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|