Skip to content

Commit a6ce0e2

Browse files
committed
Test that ending tenancy forgets the stack channels properly
1 parent 68e6fd6 commit a6ce0e2

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

tests/Bootstrappers/LogTenancyBootstrapperTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@
367367

368368
// Resolve the stack channel in the central context first
369369
// (this caches the stack with its members still pointing at the central logs).
370-
Log::channel('custom_stack')->info('central');
371-
expect(file_get_contents($centralLogPath))->toContain('central');
370+
Log::channel('custom_stack')->info('central log message');
371+
expect(file_get_contents($centralLogPath))->toContain('central log message');
372372

373373
tenancy()->initialize($tenant);
374374

@@ -379,14 +379,26 @@
379379
// so 'tenant log message' should be logged to the tenant log,
380380
// not the central log.
381381
expect(file_get_contents($centralLogPath))
382-
->toContain('central')
382+
->toContain('central log message')
383383
->not()->toContain('tenant log message');
384384

385385
$tenantLogPath = storage_path('logs/laravel.log');
386-
387386
expect(file_exists($tenantLogPath))->toBeTrue();
388387
expect(file_get_contents($tenantLogPath))
389388
->toContain('tenant log message');
389+
390+
tenancy()->end();
391+
392+
Log::channel('custom_stack')->info('central after revert');
393+
394+
expect(file_get_contents($centralLogPath))
395+
->toContain('central log message')
396+
->toContain('central after revert')
397+
->not()->toContain('tenant log message');
398+
399+
expect(file_get_contents($tenantLogPath))
400+
->toContain('tenant log message')
401+
->not()->toContain('central after revert');
390402
});
391403

392404
test('slack channel uses correct webhook urls', function () {

0 commit comments

Comments
 (0)