Skip to content

Commit 9efebf9

Browse files
committed
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)
1 parent 44b97ae commit 9efebf9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@
152152
expect(app(BroadcasterContract::class)->config['key'])->toBe('tenant1_key');
153153
expect(Broadcast::driver()->config['key'])->toBe('tenant1_key');
154154

155+
// Ending tenancy after a tenant overrode the credentials reverts the broadcasters back to the central credentials
156+
tenancy()->end();
157+
158+
expect(config("broadcasting.connections.{$driver}.key"))->toBe('central_key');
159+
expect(app(BroadcastManager::class)->driver()->config['key'])->toBe('central_key');
160+
expect(app(BroadcasterContract::class)->config['key'])->toBe('central_key');
161+
expect(Broadcast::driver()->config['key'])->toBe('central_key');
162+
155163
// Initializing tenancy for a tenant without the mapped property keeps the central config value
156164
tenancy()->initialize(Tenant::create());
157165

0 commit comments

Comments
 (0)