count(3)->create(['title' => 'Alpha']); Movie::factory()->count(2)->create(['title' => 'Beta']); $res = $this->getJson('/api/movies?q=Alpha'); $res->assertOk(); $json = $res->json(); $this->assertArrayHasKey('data', $json); $this->assertSame(3, $json['total']); $this->assertCount(3, $json['data']); } public function test_public_show_returns_movie_or_404(): void { $movie = Movie::factory()->create(); $this->getJson('/api/movies/'.$movie->id) ->assertOk() ->assertJsonPath('id', $movie->id); $this->getJson('/api/movies/999999')->assertNotFound(); } }