mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:34:04 +00:00
Add Predis support
This commit is contained in:
parent
d2171b5dc5
commit
6585ecd962
2 changed files with 3 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ trait BootstrapsTenancy
|
||||||
$client = Redis::connection($connection)->client();
|
$client = Redis::connection($connection)->client();
|
||||||
try {
|
try {
|
||||||
$client->setOption($client::OPT_PREFIX, $prefix);
|
$client->setOption($client::OPT_PREFIX, $prefix);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $t) {
|
||||||
throw new PhpRedisNotInstalledException();
|
throw new PhpRedisNotInstalledException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class BootstrapsTenancyTest extends TestCase
|
||||||
public function predis_is_supported()
|
public function predis_is_supported()
|
||||||
{
|
{
|
||||||
Config::set('database.redis.client', 'predis');
|
Config::set('database.redis.client', 'predis');
|
||||||
|
Redis::setDriver('predis');
|
||||||
Config::set('tenancy.redis.multitenant', false);
|
Config::set('tenancy.redis.multitenant', false);
|
||||||
|
|
||||||
// assert no exception is thrown from initializing tenancy
|
// assert no exception is thrown from initializing tenancy
|
||||||
|
|
@ -46,8 +47,8 @@ class BootstrapsTenancyTest extends TestCase
|
||||||
public function predis_is_not_supported_without_disabling_redis_multitenancy()
|
public function predis_is_not_supported_without_disabling_redis_multitenancy()
|
||||||
{
|
{
|
||||||
Config::set('database.redis.client', 'predis');
|
Config::set('database.redis.client', 'predis');
|
||||||
|
Redis::setDriver('predis');
|
||||||
|
|
||||||
// todo
|
|
||||||
$this->expectException(PhpRedisNotInstalledException::class);
|
$this->expectException(PhpRedisNotInstalledException::class);
|
||||||
$this->initTenancy();
|
$this->initTenancy();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue