public function testDetailCanIncludeNestedExceptions()
 {
     $exceptionChild = new \Exception('child exception');
     $exceptionParent = new \Exception('parent exception', null, $exceptionChild);
     $apiProblem = new ApiProblem('500', $exceptionParent);
     $apiProblem->setDetailIncludesStackTrace(true);
     $payload = $apiProblem->toArray();
     $this->assertArrayHasKey('detail', $payload);
     $expected = $exceptionParent->getMessage() . "\n" . $exceptionParent->getTraceAsString() . "\n" . $exceptionChild->getMessage() . "\n" . $exceptionChild->getTraceAsString();
     $this->assertEquals($expected, $payload['detail']);
 }
 /**
  * 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());
 }