diff --git a/src/Bootstrappers/CacheTagBootstrapper.php b/src/Bootstrappers/CacheTagBootstrapper.php new file mode 100644 index 00000000..3721e9db --- /dev/null +++ b/src/Bootstrappers/CacheTagBootstrapper.php @@ -0,0 +1,22 @@ +mockConsoleOutput = false; @@ -84,11 +83,9 @@ test('database data is separated', function () { }); test('cache data is separated', function () { - CacheManager::$addTags = true; - config([ 'tenancy.bootstrappers' => [ - PrefixCacheTenancyBootstrapper::class, + CacheTagBootstrapper::class, ], 'cache.default' => 'redis', ]); diff --git a/tests/CacheManagerTest.php b/tests/CacheManagerTest.php index 7b1b99da..ff8a853b 100644 --- a/tests/CacheManagerTest.php +++ b/tests/CacheManagerTest.php @@ -2,16 +2,15 @@ declare(strict_types=1); -use Stancl\Tenancy\CacheManager; use Stancl\Tenancy\Tests\Etc\Tenant; use Illuminate\Support\Facades\Event; use Stancl\Tenancy\Events\TenancyInitialized; use Stancl\Tenancy\Listeners\BootstrapTenancy; +use Stancl\Tenancy\Bootstrappers\CacheTagBootstrapper; beforeEach(function () { - config(['tenancy.bootstrappers' => []]); + config(['tenancy.bootstrappers' => [CacheTagBootstrapper::class]]); - CacheManager::$addTags = true; Event::listen(TenancyInitialized::class, BootstrapTenancy::class); }); diff --git a/tests/GlobalCacheTest.php b/tests/GlobalCacheTest.php index c4fcb0e5..f59ea401 100644 --- a/tests/GlobalCacheTest.php +++ b/tests/GlobalCacheTest.php @@ -2,16 +2,17 @@ declare(strict_types=1); +use Stancl\Tenancy\Tests\Etc\Tenant; use Illuminate\Support\Facades\Event; use Stancl\Tenancy\Events\TenancyEnded; -use Stancl\Tenancy\Events\TenancyInitialized; use Stancl\Tenancy\Facades\GlobalCache; +use Stancl\Tenancy\Events\TenancyInitialized; use Stancl\Tenancy\Listeners\BootstrapTenancy; use Stancl\Tenancy\Listeners\RevertToCentralContext; -use Stancl\Tenancy\Tests\Etc\Tenant; +use Stancl\Tenancy\Bootstrappers\CacheTagBootstrapper; beforeEach(function () { - config(['tenancy.bootstrappers' => []]); + config(['tenancy.bootstrappers' => [CacheTagBootstrapper::class]]); Event::listen(TenancyInitialized::class, BootstrapTenancy::class); Event::listen(TenancyEnded::class, RevertToCentralContext::class);