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

Reset static $stores property

This commit is contained in:
Samuel Štancl 2025-08-06 20:44:05 +02:00
parent 6a8358fd80
commit a760c52ef2
3 changed files with 16 additions and 11 deletions

View file

@ -29,6 +29,8 @@ beforeEach(function () {
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
DatabaseCacheBootstrapper::$stores = null;
config([
'cache.stores.database.connection' => 'central', // Explicitly set cache DB connection name in config
'cache.stores.database.lock_connection' => 'central', // Also set lock connection name
@ -40,6 +42,10 @@ beforeEach(function () {
]);
});
afterEach(function () {
DatabaseCacheBootstrapper::$stores = null;
});
test('DatabaseCacheBootstrapper switches the database cache store connections correctly', function () {
// Original connections (store and lock) are 'central' in the config
expect(config('cache.stores.database.connection'))->toBe('central');