mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:34:04 +00:00
Fix tests
This commit is contained in:
parent
f34e1e97ac
commit
2757e8f76c
3 changed files with 20 additions and 1 deletions
|
|
@ -88,4 +88,21 @@ class CacheManagerTest extends TestCase
|
||||||
tenancy()->init('foo.localhost');
|
tenancy()->init('foo.localhost');
|
||||||
$this->assertSame('bar', cache('foo'));
|
$this->assertSame('bar', cache('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function cache_is_persisted_when_reidentification_is_used()
|
||||||
|
{
|
||||||
|
tenant()->create('foo.localhost');
|
||||||
|
tenant()->create('bar.localhost');
|
||||||
|
tenancy()->init('foo.localhost');
|
||||||
|
|
||||||
|
cache(['foo' => 'bar'], 10);
|
||||||
|
$this->assertSame('bar', cache('foo'));
|
||||||
|
|
||||||
|
tenancy()->init('bar.localhost');
|
||||||
|
tenancy()->end();
|
||||||
|
|
||||||
|
tenancy()->init('foo.localhost');
|
||||||
|
$this->assertSame('bar', cache('foo'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class GlobalCacheTest extends TestCase
|
||||||
$this->assertSame('bar', GlobalCache::get('foo'));
|
$this->assertSame('bar', GlobalCache::get('foo'));
|
||||||
|
|
||||||
GlobalCache::put(['abc' => 'xyz'], 1);
|
GlobalCache::put(['abc' => 'xyz'], 1);
|
||||||
cache(['def' => 'ghi'], 1);
|
cache(['def' => 'ghi'], 10);
|
||||||
$this->assertSame('ghi', cache('def'));
|
$this->assertSame('ghi', cache('def'));
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
Redis::connection('tenancy')->flushdb();
|
Redis::connection('tenancy')->flushdb();
|
||||||
|
Redis::connection('cache')->flushdb();
|
||||||
|
|
||||||
if ($this->autoCreateTenant) {
|
if ($this->autoCreateTenant) {
|
||||||
$this->createTenant();
|
$this->createTenant();
|
||||||
|
|
@ -77,6 +78,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
's3',
|
's3',
|
||||||
],
|
],
|
||||||
'tenancy.redis.tenancy' => true,
|
'tenancy.redis.tenancy' => true,
|
||||||
|
'tenancy.redis.prefixed_connections' => ['default'],
|
||||||
'tenancy.migrations_directory' => database_path('../migrations'),
|
'tenancy.migrations_directory' => database_path('../migrations'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue