mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:44:02 +00:00
Add more TenantManager tests
This commit is contained in:
parent
2c69c37032
commit
8d382024a3
3 changed files with 64 additions and 13 deletions
|
|
@ -17,5 +17,53 @@ class TenantManagerTest extends TestCase
|
|||
$this->assertSame($tenant, tenancy()->tenant);
|
||||
}
|
||||
|
||||
// todo write more tests
|
||||
/** @test */
|
||||
public function invoke_works()
|
||||
{
|
||||
$this->assertSame(tenant('uuid'), tenant()('uuid'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function initById_works()
|
||||
{
|
||||
$tenant = tenant()->create('foo.localhost');
|
||||
|
||||
$this->assertNotSame($tenant, tenancy()->tenant);
|
||||
|
||||
tenancy()->initById($tenant['uuid']);
|
||||
|
||||
$this->assertSame($tenant, tenancy()->tenant);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function findByDomain_works()
|
||||
{
|
||||
$tenant = tenant()->create('foo.localhost');
|
||||
|
||||
$this->assertSame($tenant, tenant()->findByDomain('foo.localhost'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getIdByDomain_works()
|
||||
{
|
||||
$tenant = tenant()->create('foo.localhost');
|
||||
$this->assertSame(tenant()->getTenantIdByDomain('foo.localhost'), tenant()->getIdByDomain('foo.localhost'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function findWorks()
|
||||
{
|
||||
tenant()->create('dev.localhost');
|
||||
tenancy()->init('dev.localhost');
|
||||
|
||||
$this->assertSame(tenant()->tenant, tenant()->find(tenant('uuid')));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getTenantByIdWorks()
|
||||
{
|
||||
$tenant = tenant()->create('foo.localhost');
|
||||
|
||||
$this->assertSame($tenant, tenancy()->getTenantById($tenant['uuid']));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue