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

Test configuring BroadcastingConfigBootstrapper::$broadcaster

This commit is contained in:
lukinovec 2026-07-12 12:41:30 +02:00
parent e6c4c317fe
commit 4422df2e04

View file

@ -344,3 +344,21 @@ test('initializing tenancy does not fail when the broadcaster does not extend th
->toBeInstanceOf(get_class($contractBroadcaster)) ->toBeInstanceOf(get_class($contractBroadcaster))
->not()->toBe($centralBroadcaster); ->not()->toBe($centralBroadcaster);
}); });
test('setting the broadcaster property overrides which map preset is used', function () {
config([
'tenancy.bootstrappers' => [BroadcastingConfigBootstrapper::class],
'broadcasting.default' => 'testing',
'broadcasting.connections.testing.driver' => 'testing',
'broadcasting.connections.pusher.key' => 'central_key',
]);
app(BroadcastManager::class)->extend('testing', fn () => new TestingBroadcaster('testing'));
// Use the pusher preset even though the default connection isn't pusher
BroadcastingConfigBootstrapper::$broadcaster = 'pusher';
tenancy()->initialize(Tenant::create(['pusher_key' => 'tenant_key']));
expect(config('broadcasting.connections.pusher.key'))->toBe('tenant_key');
});