errorHandler = new JsonErrorHandler(); } /** * @test */ public function noErrorStatusReturnsInternalServerError() { $response = $this->errorHandler->__invoke(null, ServerRequestFactory::fromGlobals(), new Response()); $this->assertInstanceOf(Response\JsonResponse::class, $response); $this->assertEquals(500, $response->getStatusCode()); } /** * @test */ public function errorStatusReturnsThatStatus() { $response = $this->errorHandler->__invoke( null, ServerRequestFactory::fromGlobals(), (new Response())->withStatus(405) ); $this->assertInstanceOf(Response\JsonResponse::class, $response); $this->assertEquals(405, $response->getStatusCode()); } }