indexRouteName = "{$route_prefix}{$this->resourceName()}.index"; } /** * Create instances of the model being tested. */ protected function createInstances(int $count = 1): Collection { return $this->factory()->count($count)->create(); } public function testCanGetIndex(): void { $this->createInstances(10); $index_url = route($this->indexRouteName); $response = $this->get($index_url); $response->assertOk(); $response->assertJson(['data' => true]); $response->assertJsonCount(10, 'data'); } }