jonnybarnes.uk/tests/Feature/SearchTest.php
Jonny Barnes 1dfa17abca
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
Update Laravel to v12
2025-04-01 21:10:30 +01:00

27 lines
622 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature;
use App\Models\Note;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class SearchTest extends TestCase
{
#[Test]
public function searchEndpointReturnsResults(): void
{
Note::factory(10)->create();
Note::Factory()->create(['note' => 'hello world']);
$response = $this->get('/search?q=hello');
$response->assertStatus(200);
$response->assertViewIs('search');
$response->assertViewHas('search');
$response->assertViewHas('notes');
$response->assertSee('hello world');
}
}