1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 20:54:04 +00:00

Update prefix bootstrapper and test (setStore() in CacheManager and Repository needed)

This commit is contained in:
lukinovec 2022-12-08 16:24:54 +01:00
parent 4c33df1aa5
commit 825a565fa2
2 changed files with 27 additions and 17 deletions

View file

@ -26,7 +26,7 @@ test('cache prefix is separate for each tenant', function () {
$originalPrefix = config('cache.prefix');
$prefixBase = config('tenancy.cache.prefix_base');
expect($originalPrefix . ':') // cache manager postfix ':' to prefix
expect($originalPrefix . ':') // RedisStore suffixes prefix with ':'
->toBe(app('cache')->getPrefix())
->toBe(app('cache.store')->getPrefix());
@ -53,7 +53,9 @@ test('cache prefix is separate for each tenant', function () {
// Assert tenants' data is accessible using the prefix from the central context
tenancy()->end();
config(['cache.prefix' => null]); // stop prefixing cache keys in central so we can provide prefix manually
app('cache')->forgetDriver(config('cache.default'));
expect(cache($tenantOnePrefix . ':key'))->toBe('tenantone-value');
expect(cache($tenantTwoPrefix . ':key'))->toBe('tenanttwo-value');