assertFileExists($path); $stream = Psr7\stream_for(file_get_contents($path)); $this->assertInstanceOf(Psr7\Stream::class, $stream); return $stream; } /** * Returns a PSR7 Response (JSON) for a given fixture. * * @param string $fixture The fixture to create the response for. * @param integer $statusCode A HTTP Status Code for the response. * @return Psr7\Response */ protected function getPsr7JsonResponseForFixture($fixture, $statusCode = 200): Psr7\Response { $stream = $this->getPsr7StreamForFixture($fixture); $this->assertNotNull(json_decode($stream)); $this->assertEquals(JSON_ERROR_NONE, json_last_error()); return new Psr7\Response($statusCode, ['Content-Type' => 'application/json'], $stream); } }