make();
$response = $this->actingAs($user)
->get('/admin/bio');
$response->assertSeeText('Edit bio');
}
#[Test]
public function admin_can_create_bio(): void
{
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/bio', [
'_method' => 'PUT',
'content' => 'Bio content',
]);
$this->assertDatabaseHas('bios', ['content' => 'Bio content']);
}
#[Test]
public function admin_can_load_existing_bio(): void
{
$user = User::factory()->make();
$bio = Bio::factory()->create([
'content' => 'This is my bio. It uses HTML.',
]);
$response = $this->actingAs($user)
->get('/admin/bio');
$response->assertSeeText('This is my bio. It uses HTML.');
}
#[Test]
public function admin_can_edit_bio(): void
{
$user = User::factory()->make();
$bio = Bio::factory()->create();
$this->actingAs($user)
->post('/admin/bio', [
'_method' => 'PUT',
'content' => 'This bio has been edited',
]);
$this->assertDatabaseHas('bios', [
'content' => 'This bio has been edited',
]);
}
}