From a52efe5cf0d9cb5ff97ad465b1b1b7ddfab248b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Thu, 3 Oct 2024 21:34:05 +0200 Subject: [PATCH] wip broadcasting test fixes --- composer.json | 2 ++ tests/BroadcastingTest.php | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f25d8c91..e510b395 100644 --- a/composer.json +++ b/composer.json @@ -69,6 +69,8 @@ "docker-restart": "docker-compose down && docker-compose up -d", "docker-rebuild": "PHP_VERSION=8.3 docker-compose up -d --no-deps --build", "docker-m1": "ln -s docker-compose-m1.override.yml docker-compose.override.yml", + "testbench-unlink": "rm ./vendor/orchestra/testbench-core/laravel/vendor", + "testbench-link": "ln -s vendor ./vendor/orchestra/testbench-core/laravel/vendor", "coverage": "open coverage/phpunit/html/index.html", "phpstan": "vendor/bin/phpstan", "phpstan-pro": "vendor/bin/phpstan --pro", diff --git a/tests/BroadcastingTest.php b/tests/BroadcastingTest.php index 126a1843..bd15df18 100644 --- a/tests/BroadcastingTest.php +++ b/tests/BroadcastingTest.php @@ -136,9 +136,11 @@ test('broadcasting channel helpers register channels correctly', function() { // Tenant channel registered – its name is correctly prefixed ("{tenant}.user.{userId}") $tenantChannelClosure = $getChannels()->first(fn ($closure, $name) => $name === "{tenant}.$channelName"); - expect($tenantChannelClosure) - ->not()->toBeNull() // Channel registered - ->not()->toBe($centralChannelClosure); // The tenant channel closure is different – after the auth user, it accepts the tenant ID + expect($tenantChannelClosure)->toBe($centralChannelClosure); + + // todo: fix tests from below here as the closure is now NOT modified, the $tenant parameter is expected (when additional parameters are used) and kept + // and the universal_channel() helper was removed (get rid of tests related to testing the helper's behavior, but tests which use universal channels should + // be kept -- the two channels should just be registered by hand per docs instead of using the now removed helper) // The tenant channels are prefixed with '{tenant}.' // They accept the tenant key, but their closures only run in tenant context when tenancy is initialized