/**
  * @param Request $request
  * @param ResponseModel $responseModel
  * @return mixed|string
  */
 protected function getSerializedContent(Request $request, ResponseModel $responseModel)
 {
     return $this->serializer->serialize($responseModel->toArray(), $request->getRequestFormat(), $this->getSerializerContext());
 }
 public function testReturnStackTraceDisabled()
 {
     $responseContainer = new ResponseModel();
     $responseContainer->setException(new \Exception('Test'));
     $responseContainer->setReturnStackTrace(false);
     $this->assertFalse($responseContainer->isReturnStackTrace());
     $data = $responseContainer->toArray();
     $this->assertArrayHasKey('error', $data);
     $this->assertArrayNotHasKey('stack_trace', $data['error']);
 }