1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 09:54:03 +00:00

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)
This commit is contained in:
lukinovec 2026-07-16 12:26:30 +02:00
parent 44b97ae096
commit 9efebf964c

View file

@ -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());