mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:04:02 +00:00
Inline variable & config key assignment
This commit is contained in:
parent
cb07a47f18
commit
4d387188c5
1 changed files with 5 additions and 5 deletions
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue