base commit
This commit is contained in:
28
tests/Feature/Filament/PanelAccessTest.php
Normal file
28
tests/Feature/Filament/PanelAccessTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
it('redirects guests from the admin panel to login', function (): void {
|
||||
$this->get('/admin')
|
||||
->assertRedirect('/admin/login');
|
||||
});
|
||||
|
||||
it('allows authenticated super admin users to access the admin panel', function (): void {
|
||||
$admin = createAdminUser();
|
||||
|
||||
$this->actingAs($admin)
|
||||
->get('/admin')
|
||||
->assertSuccessful();
|
||||
});
|
||||
|
||||
it('redirects authenticated non-admin users without panel access', function (): void {
|
||||
seedRoles();
|
||||
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get('/admin')
|
||||
->assertForbidden();
|
||||
});
|
||||
Reference in New Issue
Block a user