role listing

This commit is contained in:
2026-05-11 11:41:27 +08:00
parent 5f361d0e39
commit 909c767e01
7 changed files with 133 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?php
use App\Models\Role;
use App\Models\User;
test('role index requires authentication', function () {
$this->get('/role')->assertRedirect('/login');
});
test('authenticated users can view the role index', function () {
Role::query()->create(['name' => 'Admin']);
Role::query()->create(['name' => 'Editor']);
$response = $this
->actingAs(User::factory()->create())
->get('/role');
$response
->assertSuccessful()
->assertSee('Roles')
->assertSee('Admin')
->assertSee('Editor');
});