mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Hide the Notifications resource from the sidebar navigation and surface it as a user-menu item (avatar dropdown) instead, linking to the same page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Filament;
|
|
|
|
use App\Filament\Resources\NotificationHistoryResource;
|
|
use App\Models\User;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class NotificationsUserMenuTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
$this->actingAs(User::factory()->create());
|
|
Filament::setCurrentPanel(Filament::getPanel('admin'));
|
|
}
|
|
|
|
public function test_notifications_is_not_registered_in_the_sidebar_navigation()
|
|
{
|
|
$this->assertFalse(NotificationHistoryResource::shouldRegisterNavigation());
|
|
}
|
|
|
|
public function test_notifications_is_available_in_the_user_menu()
|
|
{
|
|
$items = collect(Filament::getCurrentPanel()->getUserMenuItems());
|
|
|
|
$notifications = $items->first(fn ($item) => $item->getLabel() === 'Notifications');
|
|
|
|
$this->assertNotNull($notifications, 'Notifications should be in the user menu.');
|
|
$this->assertSame(NotificationHistoryResource::getUrl('index'), $notifications->getUrl());
|
|
}
|
|
}
|