make(); $response = $this->actingAs($user) ->get('/admin/clients'); $response->assertSeeText('Clients'); } #[Test] public function adminCanLoadFormToCreateClient(): void { $user = User::factory()->make(); $response = $this->actingAs($user) ->get('/admin/clients/create'); $response->assertSeeText('New Client'); } #[Test] public function adminCanCreateNewClient(): void { $user = User::factory()->make(); $this->actingAs($user) ->post('/admin/clients', [ 'client_name' => 'Micropublish', 'client_url' => 'https://micropublish.net', ]); $this->assertDatabaseHas('clients', [ 'client_name' => 'Micropublish', 'client_url' => 'https://micropublish.net', ]); } #[Test] public function adminCanLoadEditFormForClient(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create([ 'client_url' => 'https://jbl5.dev/notes/new', ]); $response = $this->actingAs($user) ->get('/admin/clients/' . $client->id . '/edit'); $response->assertSee('https://jbl5.dev/notes/new'); } #[Test] public function adminCanEditClient(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create(); $this->actingAs($user) ->post('/admin/clients/' . $client->id, [ '_method' => 'PUT', 'client_url' => 'https://jbl5.dev/notes/new', 'client_name' => 'JBL5dev', ]); $this->assertDatabaseHas('clients', [ 'client_url' => 'https://jbl5.dev/notes/new', 'client_name' => 'JBL5dev', ]); } #[Test] public function adminCanDeleteClient(): void { $user = User::factory()->make(); $client = MicropubClient::factory()->create([ 'client_url' => 'https://jbl5.dev/notes/new', ]); $this->actingAs($user) ->post('/admin/clients/' . $client->id, [ '_method' => 'DELETE', ]); $this->assertDatabaseMissing('clients', [ 'client_url' => 'https://jbl5.dev/notes/new', ]); } }