<?php
declare(strict_types=1);
namespace Tests\Feature\Admin;
use App\Models\MicropubClient;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ClientsTest extends TestCase
{
use RefreshDatabase;
#[Test]
public function clients_page_loads(): void
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/clients');
$response->assertSeeText('Clients');
}
public function admin_can_load_form_to_create_client(): void
->get('/admin/clients/create');
$response->assertSeeText('New Client');
public function admin_can_create_new_client(): void
$this->actingAs($user)
->post('/admin/clients', [
'client_name' => 'Micropublish',
'client_url' => 'https://micropublish.net',
]);
$this->assertDatabaseHas('clients', [
public function admin_can_load_edit_form_for_client(): void
$client = MicropubClient::factory()->create([
'client_url' => 'https://jbl5.dev/notes/new',
->get('/admin/clients/' . $client->id . '/edit');
$response->assertSee('https://jbl5.dev/notes/new');
public function admin_can_edit_client(): void
$client = MicropubClient::factory()->create();
->post('/admin/clients/' . $client->id, [
'_method' => 'PUT',
'client_name' => 'JBL5dev',
public function admin_can_delete_client(): void
'_method' => 'DELETE',
$this->assertDatabaseMissing('clients', [