From 4d387188c5d00537b1cb35882199a6595a2faa27 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Tue, 18 Apr 2023 16:10:47 +0200 Subject: [PATCH] Inline variable & config key assignment --- tests/PrefixCacheBootstrapperTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/PrefixCacheBootstrapperTest.php b/tests/PrefixCacheBootstrapperTest.php index 939213c9..41261a52 100644 --- a/tests/PrefixCacheBootstrapperTest.php +++ b/tests/PrefixCacheBootstrapperTest.php @@ -152,14 +152,13 @@ test('central cache is persisted', function () { }); test('cache base prefix is customizable', function () { - $originalPrefix = config('cache.prefix'); - $prefixBase = 'custom_'; - config([ - 'tenancy.cache.prefix_base' => $prefixBase + 'tenancy.cache.prefix_base' => $prefixBase = 'custom_' ]); + $originalPrefix = config('cache.prefix'); $tenant1 = Tenant::create(); + tenancy()->initialize($tenant1); expect($originalPrefix . $prefixBase . $tenant1->getTenantKey() . ':') @@ -339,12 +338,13 @@ test('cache store prefix generation can be customized', function() { // Expect the 'redis' store to use the prefix generated by the custom generator expect($customPrefixGenerator($tenant) . ':') ->toBe(cache()->getPrefix()) - ->toBe(cache()->store('redis2')->getPrefix()) // Non-default cache stores are prefixed too (when they're in $tenantCacheStores) + ->toBe(cache()->store('redis2')->getPrefix()) // Non-default cache stores specified in $tenantCacheStores are prefixed too ->toBe(app('cache')->getPrefix()) ->toBe(app('cache.store')->getPrefix()); config(['cache.default' => 'redis2']); + // Use different prefix generator PrefixCacheTenancyBootstrapper::generatePrefixUsing($customPrefixGenerator = function (Tenant $tenant) { return 'redis2_tenant_cache_' . $tenant->getTenantKey(); });