/** * @inheritdoc */ private function error($statusCode, $message, \Exception $e, $headers = []) { $responseArray = ['error' => ['http_status' => $statusCode, 'message' => $message]]; // Other than production, debug information will be included with // the returned query if an exception is thrown and caught by the handler $appEnv = getenv('APP_ENV'); if ($appEnv and $appEnv !== 'production') { $responseArray['debug'] = $this->debug($e); } return $this->factory->makeRepresentationCreator()->make($responseArray, $statusCode, $headers); }
protected function errorExpectations($statusCode, $message, Factory $factory, RepresentationCreator $representationCreator, Response $response, $headers = []) { $responseArray = ['error' => ['http_status' => $statusCode, 'message' => $message]]; $factory->makeRepresentationCreator()->shouldBeCalled()->willReturn($representationCreator); $representationCreator->make($responseArray, $statusCode, $headers)->shouldBeCalled()->willReturn($response); }