1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 09:54:05 +00:00
This commit is contained in:
Samuel Štancl 2020-03-14 01:56:55 +01:00
parent 01c9671461
commit a99f5d916d

View file

@ -8,6 +8,9 @@ use Stancl\Tenancy\Tenant;
class CachedResolverTest extends TestCase class CachedResolverTest extends TestCase
{ {
public $autoCreateTenant = false;
public $autoInitTenancy = false;
public function setUp(): void public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -20,7 +23,7 @@ class CachedResolverTest extends TestCase
/** @test */ /** @test */
public function a_query_is_not_made_for_tenant_id_once_domain_is_cached() public function a_query_is_not_made_for_tenant_id_once_domain_is_cached()
{ {
$tenant = Tenant::new()->withDomains(['foo.localhost']); $tenant = Tenant::new()->withDomains(['foo.localhost'])->save();
// todo assert query is made: // todo assert query is made:
$queried = tenancy()->findByDomain('foo.localhost'); $queried = tenancy()->findByDomain('foo.localhost');
@ -32,7 +35,7 @@ class CachedResolverTest extends TestCase
/** @test */ /** @test */
public function a_query_is_not_made_for_tenant_once_id_is_cached() public function a_query_is_not_made_for_tenant_once_id_is_cached()
{ {
$tenant = Tenant::new()->withData(['id' => '123']); $tenant = Tenant::new()->withData(['id' => '123'])->save();
// todo assert query is made: // todo assert query is made:
$queried = tenancy()->find('123'); $queried = tenancy()->find('123');
@ -49,7 +52,7 @@ class CachedResolverTest extends TestCase
/** @test */ /** @test */
public function modifying_tenants_data_updates_data_in_the_cached_id_to_tenant_data_mapping() public function modifying_tenants_data_updates_data_in_the_cached_id_to_tenant_data_mapping()
{ {
$tenant = Tenant::new()->withData(['id' => '123', 'foo' => 'bar']); $tenant = Tenant::new()->withData(['id' => '123', 'foo' => 'bar'])->save();
// todo assert cache record is set // todo assert cache record is set
$this->assertSame('bar', tenancy()->find('123')->get('foo')); $this->assertSame('bar', tenancy()->find('123')->get('foo'));