jonnybarnes.uk/tests/Feature/SearchTest.php

28 lines
625 B
PHP
Raw Normal View History

2023-04-11 21:16:06 +01:00
<?php
declare(strict_types=1);
namespace Tests\Feature;
use App\Models\Note;
2025-03-01 15:00:41 +00:00
use PHPUnit\Framework\Attributes\Test;
2023-04-11 21:16:06 +01:00
use Tests\TestCase;
class SearchTest extends TestCase
{
2025-03-01 15:00:41 +00:00
#[Test]
2025-04-06 17:25:06 +01:00
public function search_endpoint_returns_results(): void
2023-04-11 21:16:06 +01:00
{
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');
}
}