From 23149473a99e1e979c66cb0a14c5a3a73a52ad49 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 17 Jul 2026 10:27:21 +0200 Subject: [PATCH] Assert that the bound broadcaster and the manager's default driver are in sync in all contexts --- tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php index 110d028c..4bf45d78 100644 --- a/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php +++ b/tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php @@ -60,7 +60,7 @@ test('BroadcastingConfigBootstrapper binds a fresh BroadcastManager and reverts expect(app(BroadcastManager::class))->toBe($centralManager); }); -test('ending tenancy reverts the bound broadcaster to the original instance', function () { +test('bound broadcaster matches the manager default driver in every context and ending tenancy reverts it to the original instance', function () { config([ 'tenancy.bootstrappers' => [BroadcastingConfigBootstrapper::class], 'broadcasting.default' => 'testing', @@ -71,6 +71,9 @@ test('ending tenancy reverts the bound broadcaster to the original instance', fu $originalBroadcaster = app(BroadcasterContract::class); + // The bound broadcaster and the manager's default driver should be the same instance in every context + expect(app(BroadcasterContract::class))->toBe(app(BroadcastManager::class)->driver()); + tenancy()->initialize(Tenant::create()); // BroadcastingConfigBootstrapper binds a freshly resolved broadcaster @@ -83,6 +86,8 @@ test('ending tenancy reverts the bound broadcaster to the original instance', fu // Ending tenancy reverts the binding back to the original broadcaster instance expect($originalBroadcaster)->toBe(app(BroadcasterContract::class)); + // The bound broadcaster is still the same as the central manager's default driver + expect(app(BroadcasterContract::class))->toBe(app(BroadcastManager::class)->driver()); }); test('BroadcastingConfigBootstrapper maps tenant properties to broadcaster credentials correctly', function (string $driver) {