@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SitePagesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array<string, array{string, string}>
|
||||
*/
|
||||
public static function pages(): array
|
||||
{
|
||||
return [
|
||||
'home' => ['home', 'site/home'],
|
||||
'about' => ['about', 'site/about'],
|
||||
'services' => ['services', 'site/services'],
|
||||
'clients' => ['clients', 'site/clients'],
|
||||
'contact' => ['contact', 'site/contact'],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('pages')]
|
||||
public function test_public_page_renders_its_component(string $route, string $component)
|
||||
{
|
||||
$this->get(route($route))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page->component($component));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user