<?php
namespace Tests\Unit;
use App\Models\Post;
use App\Models\User;
use Tests\TestCase;
class SearchTest extends TestCase
{
/** @test * */
public function it_can_find_a_post()
{
// Given
$post = \factory(Post::class)->create([
'user_id' => \factory(User::class)->create()->id,
]);
// When
$searchResults = Post::search($post->title)->get();
// Then
$this->assertTrue($searchResults->contains($post), 'Failed asserting that search results contain the given post.');
}
}