TenantAtlas/apps/platform/tests/Feature/Filament/DatabaseNotificationsPollingTest.php
Ahmed Darrazi 72ddc18743 feat: implement spec 192 header discipline
- land the spec 192 resource, guard, browser smoke, and documentation changes
- add unhandled rejection request correlation for 419 diagnostics
- disable panel-wide database notification polling and cover it with focused tests
2026-04-11 23:09:42 +02:00

35 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Workspaces\WorkspaceContext;
use Filament\Facades\Filament;
it('keeps database notifications enabled without background polling on every panel', function (): void {
foreach (['admin', 'tenant', 'system'] as $panelId) {
$panel = Filament::getPanel($panelId);
expect($panel->hasDatabaseNotifications())->toBeTrue();
expect($panel->getDatabaseNotificationsPollingInterval())->toBeNull();
}
});
it('renders the admin notifications modal without a polling attribute', function (): void {
[$user, $tenant] = createUserWithTenant(role: 'owner');
$response = $this->actingAs($user)
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get('/admin');
$response->assertSuccessful();
$html = $response->getContent();
expect($html)->toContain('wire:name="Filament\\Livewire\\DatabaseNotifications"');
preg_match('/<[^>]+wire:name="Filament\\\\Livewire\\\\DatabaseNotifications"[^>]*>/', $html, $matches);
expect($matches)->not->toBeEmpty('Expected the admin page to render the database notifications Livewire root element.');
expect($matches[0])->not->toContain('wire:poll');
expect($matches[0])->not->toContain('wire:poll.30s');
});