feat: notification on filament dashboard
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user