mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:04:02 +00:00
Remove controller tests for path identification
This commit is contained in:
parent
5e6d82be57
commit
aff52458f9
2 changed files with 22 additions and 34 deletions
|
|
@ -59,9 +59,31 @@ class DomainTest extends TestCase
|
||||||
|
|
||||||
app(DomainTenantResolver::class)->resolve('foo.localhost');
|
app(DomainTenantResolver::class)->resolve('foo.localhost');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function tenancy_is_initialized_prior_to_controller_constructors()
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
$this->assertTrue(app('tenancy_was_initialized_in_constructor'));
|
||||||
|
$this->assertTrue(tenancy()->initialized);
|
||||||
|
$this->assertSame('acme', tenant('id'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Tenant extends Models\Tenant
|
class Tenant extends Models\Tenant
|
||||||
{
|
{
|
||||||
use HasDomains;
|
use HasDomains;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TestController
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
app()->instance('tenancy_was_initialized_in_constructor', tenancy()->initialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return 'foo';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -74,38 +74,4 @@ class PathIdentificationTest extends TestCase
|
||||||
|
|
||||||
$this->assertFalse(tenancy()->initialized);
|
$this->assertFalse(tenancy()->initialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function tenancy_is_initialized_prior_to_controller_constructors()
|
|
||||||
{
|
|
||||||
// todo same test for domain resolver
|
|
||||||
|
|
||||||
Tenant::create([
|
|
||||||
'id' => 'acme',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertFalse(tenancy()->initialized);
|
|
||||||
|
|
||||||
$this
|
|
||||||
->get('/acme/bar')
|
|
||||||
->assertSee('foo');
|
|
||||||
|
|
||||||
// todo make this pass
|
|
||||||
$this->assertTrue(app('tenancy_was_initialized_in_constructor'));
|
|
||||||
$this->assertTrue(tenancy()->initialized);
|
|
||||||
$this->assertSame('acme', tenant('id'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestController
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
app()->instance('tenancy_was_initialized_in_constructor', tenancy()->initialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return 'foo';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue