public function testUsesAdditionalDetailsFromExceptionWhenProvided() { $exception = new Exception\CreationException('exception message', 401); $exception->setAdditionalDetails(array('foo' => 'bar')); $apiProblem = new ApiProblem('401', $exception); $payload = $apiProblem->toArray(); $this->assertArrayHasKey('foo', $payload); $this->assertEquals('bar', $payload['foo']); }
/** * Render an API Problem representation * * Also sets the $apiProblem member to the passed object. * * @param ApiProblem $apiProblem * @return string */ protected function renderApiProblem(ApiProblem $apiProblem) { $this->apiProblem = $apiProblem; if ($this->displayExceptions) { $apiProblem->setDetailIncludesStackTrace(true); } return parent::render($apiProblem->toArray()); }