From 9efebf964c3687e53fd49abad4122bbc2d1fbdc6 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Thu, 16 Jul 2026 12:26:30 +0200 Subject: [PATCH] Test reverting to central credentials after a tenant with overrides The existing assertions only ran after a tenant without credential overrides, so a tenant broadcaster leaking into central context could hold the central key anyway and go unnoticed (works as a regression for the forgetDrivers() refactor) --- .../Bootstrappers/BroadcastingConfigBootstrapperTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php index 863d2936..f7aa26bc 100644 --- a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php +++ b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php @@ -152,6 +152,14 @@ test('BroadcastingConfigBootstrapper maps tenant properties to broadcaster crede expect(app(BroadcasterContract::class)->config['key'])->toBe('tenant1_key'); expect(Broadcast::driver()->config['key'])->toBe('tenant1_key'); + // Ending tenancy after a tenant overrode the credentials reverts the broadcasters back to the central credentials + tenancy()->end(); + + expect(config("broadcasting.connections.{$driver}.key"))->toBe('central_key'); + expect(app(BroadcastManager::class)->driver()->config['key'])->toBe('central_key'); + expect(app(BroadcasterContract::class)->config['key'])->toBe('central_key'); + expect(Broadcast::driver()->config['key'])->toBe('central_key'); + // Initializing tenancy for a tenant without the mapped property keeps the central config value tenancy()->initialize(Tenant::create());