1
0
Fork 0
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:
Samuel Štancl 2019-07-03 12:21:17 +02:00
parent d2171b5dc5
commit 6585ecd962
2 changed files with 3 additions and 2 deletions

View file

@ -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();
} }
} }

View file

@ -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();
} }