From 776af4643cbd181ea757e46c6c2737a12d85601c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 17 Mar 2020 15:30:24 +0100 Subject: [PATCH] Make null falsey for cache config because config is not merged recursively --- assets/config.php | 2 +- src/StorageDrivers/Database/DatabaseStorageDriver.php | 3 +-- tests/CachedResolverTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/config.php b/assets/config.php index 96cf05db..bbd2d7bb 100644 --- a/assets/config.php +++ b/assets/config.php @@ -16,7 +16,7 @@ return [ 'tenants' => 'tenants', 'domains' => 'domains', ], - 'cache_store' => false, // What store should be used to cache tenant resolution. Set to false to disable cache, null to use default store, or a string with a specific cache store name. + 'cache_store' => null, // What store should be used to cache tenant resolution. Set to null to disable cache or a string with a specific cache store name. 'cache_ttl' => 3600, // seconds ], 'redis' => [ diff --git a/src/StorageDrivers/Database/DatabaseStorageDriver.php b/src/StorageDrivers/Database/DatabaseStorageDriver.php index 42ce00b4..1303ba38 100644 --- a/src/StorageDrivers/Database/DatabaseStorageDriver.php +++ b/src/StorageDrivers/Database/DatabaseStorageDriver.php @@ -251,7 +251,6 @@ class DatabaseStorageDriver implements StorageDriver, CanDeleteKeys, CanFindByAn public function usesCache(): bool { - // null is also truthy here - return $this->app['config']['tenancy.storage_drivers.db.cache_store'] !== false; + return $this->app['config']['tenancy.storage_drivers.db.cache_store'] !== null; } } diff --git a/tests/CachedResolverTest.php b/tests/CachedResolverTest.php index 903539fd..0d32915e 100644 --- a/tests/CachedResolverTest.php +++ b/tests/CachedResolverTest.php @@ -21,7 +21,7 @@ class CachedResolverTest extends TestCase $this->markTestSkipped('This test is only relevant for the DB storage driver.'); } - config(['tenancy.storage_drivers.db.cache_store' => null]); // default driver + config(['tenancy.storage_drivers.db.cache_store' => config('cache.default')]); } /** @test */