From 20036ef1ff051d938de84f206e1c1ef03a08c8eb Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 1 Jun 2026 15:38:27 +0200 Subject: [PATCH] Clean up $adjustCacheManagerUsing in before and afterEach --- tests/CachedTenantResolverTest.php | 2 ++ tests/GlobalCacheTest.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/tests/CachedTenantResolverTest.php b/tests/CachedTenantResolverTest.php index fc6cfb79..26c4f875 100644 --- a/tests/CachedTenantResolverTest.php +++ b/tests/CachedTenantResolverTest.php @@ -24,12 +24,14 @@ use Stancl\Tenancy\Listeners\BootstrapTenancy; use Stancl\Tenancy\Listeners\RevertToCentralContext; use Stancl\Tenancy\Middleware\InitializeTenancyByPath; use Stancl\Tenancy\Resolvers\RequestDataTenantResolver; +use Stancl\Tenancy\TenancyServiceProvider; use function Stancl\Tenancy\Tests\pest; use function Stancl\Tenancy\Tests\withCacheTables; use function Stancl\Tenancy\Tests\withTenantDatabases; beforeEach($cleanup = function () { Tenant::$extraCustomColumns = []; + TenancyServiceProvider::$adjustCacheManagerUsing = null; }); afterEach($cleanup); diff --git a/tests/GlobalCacheTest.php b/tests/GlobalCacheTest.php index 4cda8b74..2bf0e3c5 100644 --- a/tests/GlobalCacheTest.php +++ b/tests/GlobalCacheTest.php @@ -13,11 +13,14 @@ use Stancl\Tenancy\Bootstrappers\CacheTagsBootstrapper; use Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper; use Stancl\Tenancy\Bootstrappers\DatabaseCacheBootstrapper; use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper; +use Stancl\Tenancy\TenancyServiceProvider; use function Stancl\Tenancy\Tests\withCacheTables; use function Stancl\Tenancy\Tests\withTenantDatabases; beforeEach(function () { + TenancyServiceProvider::$adjustCacheManagerUsing = null; + config([ 'cache.default' => 'redis', 'tenancy.cache.stores' => ['redis'], @@ -29,6 +32,10 @@ beforeEach(function () { withCacheTables(); }); +afterEach(function () { + TenancyServiceProvider::$adjustCacheManagerUsing = null; +}); + test('global cache manager stores data in global cache', function (string $store, array $bootstrappers) { config([ 'cache.default' => $store,