#4-public-user-profile

This commit is contained in:
2026-05-12 10:57:21 +08:00
parent 53be5221e9
commit b6c9557f83
42 changed files with 2994 additions and 242 deletions

View File

@@ -0,0 +1,26 @@
<?php
use App\Models\Role;
use App\Models\User;
test('author profile can be viewed by username', function () {
$author = User::factory()->create([
'name' => 'Amarul Author',
'username' => 'amarul',
'email' => 'amarul@example.com',
]);
$role = Role::query()->create(['name' => 'Writer']);
$author->roles()->attach($role);
$this->get('/author/amarul')
->assertSuccessful()
->assertSee('Amarul Author')
->assertSee('@amarul')
->assertSee('Writer')
->assertDontSee('amarul@example.com');
});
test('author profile returns not found for unknown username', function () {
$this->get('/author/missing-author')->assertNotFound();
});