From e4a4940e590aafec210c74e16e2b7e9c2c6d1910 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Tue, 18 Apr 2023 09:25:31 +0200 Subject: [PATCH] Update comments --- tests/PrefixCacheBootstrapperTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/PrefixCacheBootstrapperTest.php b/tests/PrefixCacheBootstrapperTest.php index 42978254..7f5a3f65 100644 --- a/tests/PrefixCacheBootstrapperTest.php +++ b/tests/PrefixCacheBootstrapperTest.php @@ -200,6 +200,8 @@ test('specific central cache store can be used inside a service', function () { $cacheStore = 'redis2'; // Name of the non-default, central cache store that we'll use using cache()->store($cacheStore) // Service uses the 'redis2' store which is central/not prefixed (not present in PrefixCacheTenancyBootstrapper::$tenantCacheStores) + // The service's handle() method sets the value of the cache key 'key' to the current tenant key + // Or to 'central-value' if tenancy isn't initialized $this->app->singleton(SpecificCacheStoreService::class, function() use ($cacheStore) { return new SpecificCacheStoreService($this->app->make(CacheManager::class), $cacheStore); }); @@ -211,7 +213,8 @@ test('specific central cache store can be used inside a service', function () { $tenant2 = Tenant::create(); tenancy()->initialize($tenant1); - // The store isn't prefixed, so the cache isn't separated + // The store isn't prefixed, so the cache isn't separated – the values persist from one context to another + // Also check if the cache key SpecificCacheStoreService sets using the Repository singleton is set correctly expect(cache()->store($cacheStore)->get('key'))->toBe('central-value'); $this->app->make(SpecificCacheStoreService::class)->handle(); expect(cache()->store($cacheStore)->get('key'))->toBe($tenant1->getTenantKey());