create(); $controller = new LocationsController(new Response()); $response = $controller->index(); $this->validateApiResponse('/locations', 'get', $response); $this->assertEquals(['application/json'], $response->getHeader('content-type')); $this->assertJson($response->getContent()); $data = json_decode($response->getContent(), true); $this->assertArrayHasKey('data', $data); $this->assertCount(3, $data['data']); $this->assertCount(1, collect($data['data'])->filter(function ($item) use ($items) { return $item['name'] == $items->first()->getAttribute('name'); })); } }