Files
coolify/tests/Feature/ServiceDatabaseVerticalNavigationTest.php
Andras BacsaiandClaude Opus 5.5 3452faec87 fix(livewire): bind team broadcast listeners to the mounted team
Livewire rebuilds listener names from the session team on every event
call. After a team switch in another tab, open pages still listen on the
old team channel, so events failed with EventHandlerDoesNotExist (500),
or ran handlers that load resources scoped to the new team (404).

Store the team at mount and build team channel listeners from it. Events
for a team that is no longer the session team are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 10:31:32 +02:00

21 lines
1.1 KiB
PHP

<?php
it('refreshes backup executions from backup broadcasts on the current team channel', function () {
$serviceExecutions = file_get_contents(app_path('Livewire/Project/Service/BackupExecutions.php'));
$serviceBackups = file_get_contents(app_path('Livewire/Project/Service/VolumeBackup/Index.php'));
$databaseExecutions = file_get_contents(app_path('Livewire/Project/Database/BackupExecutions.php'));
$databaseBackupJob = file_get_contents(app_path('Jobs/DatabaseBackupJob.php'));
expect($serviceExecutions)
->toContain('teamChannelListeners([')
->toContain("'BackupCreated' => '\$refresh'")
->and($serviceBackups)
->toContain('teamChannelListeners([')
->toContain("'BackupCreated' => '\$refresh'")
->and($databaseExecutions)
->toContain("'BackupCreated' => 'refreshBackupExecutions'")
->not->toContain('$userId = Auth::id()')
->and(strpos($databaseBackupJob, "'finished_at' => Carbon::now()->toImmutable()"))
->toBeLessThan(strrpos($databaseBackupJob, 'BackupCreated::dispatch($this->team->id)'));
});