From 5911619887ab64bda3067e9777a7c8bcfbaa3bc8 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Sun, 12 Jul 2026 12:20:40 +0200 Subject: [PATCH] Simplify channel-passing test Remove the with() -- the test ran four times with the same TestingBroadcaster, so the only tested broadcaster was actually the testing one. Running the test just once is enough, the same things are still covered. --- .../BroadcastingConfigBootstrapperTest.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php index d2065627..d8ff8ee3 100644 --- a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php +++ b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php @@ -205,20 +205,17 @@ test('tenant broadcast manager receives the custom driver creators of the centra expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toEqualCanonicalizing($originalDrivers); }); -test('tenant broadcasters receive the channels from the broadcaster bound in central context', function(string $driver) { +test('tenant broadcasters receive the channels from the broadcaster bound in central context', function() { config([ 'tenancy.bootstrappers' => [BroadcastingConfigBootstrapper::class], - 'broadcasting.default' => $driver, + 'broadcasting.default' => 'testing', + 'broadcasting.connections.testing.driver' => 'testing', ]); - if ($driver === 'custom') { - config(['broadcasting.connections.custom.driver' => 'custom']); - } - $tenant1 = Tenant::create(); $tenant2 = Tenant::create(); - app(BroadcastManager::class)->extend($driver, fn($app, $config) => new TestingBroadcaster('testing')); + app(BroadcastManager::class)->extend('testing', fn() => new TestingBroadcaster('testing')); $getCurrentChannelsFromBoundBroadcaster = fn() => array_keys(invade(app(BroadcasterContract::class))->channels); $getCurrentChannelsThroughManager = fn() => array_keys(invade(app(BroadcastManager::class)->driver())->channels); @@ -245,12 +242,7 @@ test('tenant broadcasters receive the channels from the broadcaster bound in cen expect($channel) ->toBeIn($getCurrentChannelsThroughManager()) ->toBeIn($getCurrentChannelsFromBoundBroadcaster()); -})->with([ - 'pusher', - 'ably', - 'reverb', - 'custom', -]); +}); test('channels registered in tenant context persist within that context but do not leak into other contexts', function() { config([