feat: notification on filament dashboard

This commit is contained in:
2026-05-22 12:15:23 +02:00
parent 1c472e46db
commit 071d147888
9 changed files with 121 additions and 85 deletions
+32
View File
@@ -10,6 +10,7 @@ use Filament\Forms\Components\Select;
use Filament\Infolists\Components\TextEntry;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Filters\TernaryFilter;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
@@ -21,6 +22,37 @@ beforeEach(function () {
Filament::setCurrentPanel(Filament::getPanel('dashboard'));
});
it('suspends and reactivates users from the filament users table', function () {
$admin = User::factory()->create([
'role' => UserRole::ADMIN,
]);
$user = User::factory()->create();
$this->actingAs($admin);
Livewire::test(ListUsers::class)
->assertTableColumnExists(
'suspended_at',
fn (TextColumn $column): bool => $column->getLabel() === 'Suspendu le',
)
->assertTableFilterExists(
'suspended_at',
fn (TernaryFilter $filter): bool => $filter->getLabel() === 'Suspendu',
)
->callTableAction('suspend', $user);
expect($user->fresh()->suspended_at)->not->toBeNull()
->and($user->fresh()->suspended_by)->toBe($admin->id)
->and($user->fresh()->suspended_reason)->toBe('Suspendre');
Livewire::test(ListUsers::class)
->callTableAction('unsuspend', $user->fresh());
expect($user->fresh()->suspended_at)->toBeNull()
->and($user->fresh()->suspended_by)->toBeNull()
->and($user->fresh()->suspended_reason)->toBeNull();
});
it('exposes translated user roles in filament user screens', function () {
$admin = User::factory()->create([
'role' => UserRole::ADMIN,