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

Improve channel closure inheritance test

Originally, the test only asserted that the broadcasters inherited the correct channel  names. Now, the test also asserts that the actual closure and the channel options are inherited too.
This commit is contained in:
lukinovec 2026-07-12 12:34:42 +02:00
parent 12e51d0378
commit 0ba588d299

View file

@ -226,7 +226,7 @@ test('tenant broadcasters receive the channels from the broadcaster bound in cen
$getCurrentChannelsFromBoundBroadcaster = fn () => array_keys(invade(app(BroadcasterContract::class))->channels);
$getCurrentChannelsThroughManager = fn () => array_keys(invade(app(BroadcastManager::class)->driver())->channels);
Broadcast::channel($channel = 'testing-channel', fn () => true);
Broadcast::channel($channel = 'testing-channel', $callback = fn () => true, $options = ['guards' => ['web']]);
expect($channel)
->toBeIn($getCurrentChannelsThroughManager())
@ -238,6 +238,10 @@ test('tenant broadcasters receive the channels from the broadcaster bound in cen
->toBeIn($getCurrentChannelsThroughManager())
->toBeIn($getCurrentChannelsFromBoundBroadcaster());
// The channel auth closure and the channel options are copied to the tenant broadcaster as-is
expect(invade(app(BroadcasterContract::class))->channels[$channel])->toBe($callback);
expect(invade(app(BroadcasterContract::class))->retrieveChannelOptions($channel))->toBe($options);
tenancy()->initialize($tenant2);
expect($channel)