/**
  * @param ViewHandler $viewHandler
  * @param View $view
  * @param Request $request
  * @param string $format
  *
  * @return Response
  */
 public function handleExtension(ViewHandler $handler, View $view, Request $request, $format)
 {
     if (in_array("application/vnd.bpi.api+xml", $request->getAcceptableContentTypes())) {
         $view->setHeader("Content-Type", "application/vnd.bpi.api+xml");
     }
     return $handler->createResponse($view, $request, "xml");
 }
示例#2
0
 public function showAction($contentDocument, Request $request)
 {
     $configuration = $this->requestConfigurationFactory->createSimple($request);
     $viewerFactory = $this->get('viewer.factory');
     $viewer = $viewerFactory->create($configuration, null, $contentDocument, null, 'base');
     return $this->viewHandler->handle($viewer->createView());
 }
示例#3
0
 /**
  * Deserialize Hal object using Nocarrier's Hal library instead of using JMS Serializer
  * 
  * @param ViewHandler $viewHandler
  * @param View $view
  * @param Request $request
  * @param string $format
  *
  * @return Response
  */
 public function createResponse(ViewHandler $handler, View $view, Request $request, $format)
 {
     $hal = $view->getData();
     //if not hal object process it with default view handler
     if (!$hal instanceof Hal) {
         return $handler->createResponse($view, $request, $format);
     }
     switch ($format) {
         case 'json':
             $content = $hal->asJson();
             break;
         case 'xml':
             $content = $hal->asXml();
             break;
         default:
             throw new HttpException(500, 'Custom HalViewHandler is misconfigured. Formats for deserializing HAL objects should be json or xml.');
     }
     $response = $view->getResponse();
     $response->setContent($content);
     $response->setStatusCode($this->getStatusCode($view));
     if (!$response->headers->has('Content-Type')) {
         $response->headers->set('Content-Type', $request->getMimeType($format));
     }
     return $response;
 }
 /**
  * @Route("/{id}", name="icap_badge_api_badge_get", requirements={"id" = "\d+"}, defaults={"_format" = "json"})
  */
 public function getAction($id)
 {
     /** @var \Icap\BadgeBundle\Entity\Badge $badge */
     $badge = $this->badgeRepository->find($id);
     if (null === $badge) {
         throw new NotFoundHttpException('Badge not found');
     }
     $view = View::create()->setStatusCode(200)->setData($badge);
     return $this->viewHandler->handle($view);
 }
示例#5
0
 /**
  * Handles wrapping a JSON response into a JSONP response.
  *
  * @param ViewHandler $handler
  * @param View        $view
  * @param Request     $request
  * @param string      $format
  *
  * @return Response
  */
 public function createResponse(ViewHandler $handler, View $view, Request $request, $format)
 {
     $response = $handler->createResponse($view, $request, 'json');
     if ($response->isSuccessful()) {
         $callback = $this->getCallback($request);
         $response->setContent(sprintf('/**/%s(%s)', $callback, $response->getContent()));
         $response->headers->set('Content-Type', $request->getMimeType($format));
     }
     return $response;
 }
示例#6
0
 /**
  * {@inheritdoc}
  */
 public function handle(RequestConfiguration $requestConfiguration, View $view)
 {
     if (!$requestConfiguration->isHtmlRequest()) {
         $this->restViewHandler->setExclusionStrategyGroups($requestConfiguration->getSerializationGroups());
         if ($version = $requestConfiguration->getSerializationVersion()) {
             $this->restViewHandler->setExclusionStrategyVersion($version);
         }
         $view->getSerializationContext()->enableMaxDepthChecks();
     }
     return $this->restViewHandler->handle($view);
 }
示例#7
0
 /**
  * @param ViewHandler $viewHandler
  * @param View $view
  * @param Request $request
  * @param string $format
  *
  * @return Response
  */
 public function createResponse(ViewHandler $handler, View $view, Request $request, $format)
 {
     $format = $request->get('_format') ?: 'json';
     if ($view->getData() instanceof ImageInterface && $format != 'json') {
         $image = $view->getData();
         $content = $this->manager->getImageSource($image);
         $headers = ['Content-Type' => $image->getMimeType()];
         return new Response($content, 200, $headers);
     }
     return $handler->createResponse($view, $request, 'json');
 }
示例#8
0
 function it_sets_proper_values_for_non_html_requests(RequestConfiguration $requestConfiguration, RestViewHandler $restViewHandler, Response $response)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(false);
     $view = View::create();
     $view->setSerializationContext(new SerializationContext());
     $requestConfiguration->getSerializationGroups()->willReturn(['Detailed']);
     $requestConfiguration->getSerializationVersion()->willReturn('2.0.0');
     $restViewHandler->setExclusionStrategyGroups(['Detailed'])->shouldBeCalled();
     $restViewHandler->setExclusionStrategyVersion('2.0.0')->shouldBeCalled();
     $restViewHandler->handle($view)->willReturn($response);
     $this->handle($requestConfiguration, $view)->shouldReturn($response);
 }
示例#9
0
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  * @dataProvider getCallbackFailureDataProvider
  */
 public function testGetCallbackFailure(Request $request)
 {
     $data = ['foo' => 'bar'];
     $viewHandler = new ViewHandler($this->router, $this->serializer, $this->templating, $this->requestStack, $this->exceptionWrapperHandler, ['jsonp' => false]);
     $jsonpHandler = new JsonpHandler('callback');
     $viewHandler->registerHandler('jsonp', [$jsonpHandler, 'createResponse']);
     $this->serializer->expects($this->once())->method('serialize')->will($this->returnValue(var_export($data, true)));
     $data = ['foo' => 'bar'];
     $view = new View($data);
     $view->setFormat('jsonp');
     $viewHandler->handle($view, $request);
 }
示例#10
0
 /**
  * @ApiDoc
  *
  * @param integer $objectId            
  * @throws NotFoundHttpException
  */
 public function getUserAction($userId = 0)
 {
     /* @var $model \App\ModuleObjectsBundle\Model\MapObjectModel */
     $model = $this->container->get('app_module_user.model.user');
     $data = $model->findOneById($userId);
     if (null === $data) {
         throw new NotFoundHttpException();
     }
     $view = new View();
     $view->setData($data);
     $context = new SerializationContext();
     $context->setGroups(array('.all', 'user.get'));
     $view->setSerializationContext($context);
     return $this->viewHandler->handle($view);
 }
示例#11
0
 /**
  * @param ViewHandler   $handler
  * @param View          $view
  * @param Request       $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function createResponse(ViewHandler $handler, View $view, Request $request)
 {
     $format = $view->getFormat() ?: $request->getRequestFormat();
     $data = $view->getData();
     if ($data instanceof Cursor) {
         $view->setData(iterator_to_array($data, false));
         $view->getResponse()->headers->set('X-Total-Count', $data->count());
         return $handler->createResponse($view, $request, $view->getFormat());
     }
     if ($data instanceof Form && Codes::HTTP_BAD_REQUEST === $view->getStatusCode()) {
         $view->setData($this->formatFormErrors($data));
         return $handler->createResponse($view, $request, $format);
     }
     return $handler->createResponse($view, $request, $format);
 }
示例#12
0
 /**
  * Return a JSON encoded scalar array of index names.
  *
  * @return Response
  */
 public function indexesAction()
 {
     return $this->viewHandler->handle(View::create(array_map(function ($indexName) {
         $indexConfiguration = $this->indexConfigurationProvider->getIndexConfiguration($indexName);
         return $indexConfiguration ?: new IndexConfiguration($indexName);
     }, $this->getAllowedIndexes())));
 }
 public function jsonpAction()
 {
     $data = array('foo' => 'bar');
     $view = new View($data);
     $view->setFormat('jsonp');
     return $this->viewHandler->handle($view);
 }
 /**
  * @param View $view
  *
  * @return \JMS\Serializer\SerializationContext
  */
 protected function getSerializationContext(View $view)
 {
     $context = parent::getSerializationContext($view);
     if ($this->serializerEnableMaxDepthChecks) {
         $context->enableMaxDepthChecks();
     }
     return $context;
 }
示例#15
0
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  * @dataProvider getCallbackFailureDataProvider
  */
 public function testGetCallbackFailure(Request $request)
 {
     $data = array('foo' => 'bar');
     $viewHandler = new ViewHandler(array('jsonp' => false));
     $jsonpHandler = new JsonpHandler('callback');
     $viewHandler->registerHandler('jsonp', array($jsonpHandler, 'createResponse'));
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', array('get', 'getParameter'));
     $serializer = $this->getMock('stdClass', array('serialize', 'setVersion'));
     $serializer->expects($this->once())->method('serialize')->will($this->returnValue(var_export($data, true)));
     $container->expects($this->once())->method('get')->with('fos_rest.serializer')->will($this->returnValue($serializer));
     $container->expects($this->any())->method('getParameter')->will($this->onConsecutiveCalls('version', '1.0'));
     $viewHandler->setContainer($container);
     $data = array('foo' => 'bar');
     $view = new View($data);
     $view->setFormat('jsonp');
     $viewHandler->handle($view, $request);
 }
 /**
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $route = $request->attributes->get('_route');
     if (empty($route)) {
         $route = $request->attributes->get('_master_request_route');
     }
     if (!$this->provider->isItemWhitelisted($route)) {
         $notFoundException = new NotFoundHttpException('Sorry, the page that you requested was not found.');
         $statusCode = $notFoundException->getStatusCode();
         $parameters = ['status_code' => $statusCode, 'status_text' => Response::$statusTexts[$statusCode], 'currentContent' => '', 'exception' => FlattenException::create($notFoundException), 'logger' => $this->logger];
         $view = View::create($parameters);
         $view->setFormat(self::VIEW_FORMAT);
         $view->setTemplate($this->findTemplate($request, $statusCode, $this->kernel->isDebug()));
         $response = $this->viewHandler->handle($view);
         $event->setResponse($response);
     }
 }
示例#17
0
 /**
  * Saves a new existing snippet.
  *
  * @param Request $request
  * @param string $uuid
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function putSnippetAction(Request $request, $uuid)
 {
     $this->initEnv($request);
     $data = $request->request->all();
     $mapperRequest = ContentMapperRequest::create()->setType('snippet')->setTemplateKey($this->getRequired($request, 'template'))->setUuid($uuid)->setLocale($this->languageCode)->setUserId($this->getUser()->getId())->setData($data)->setState(intval($request->get('state', StructureInterface::STATE_PUBLISHED)));
     $snippet = $this->contentMapper->saveRequest($mapperRequest);
     $view = View::create($this->decorateSnippet($snippet->toArray(), $this->languageCode));
     return $this->viewHandler->handle($view);
 }
示例#18
0
 /**
  * Returns all the content navigation items for a given alias.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function cgetAction(Request $request)
 {
     try {
         $alias = $request->get('alias');
         if (!$alias) {
             throw new RestException('The alias attribute is required to load the content navigation');
         }
         $options = $request->query->all();
         $contentNavigationItems = $this->contentNavigationRegistry->getNavigationItems($alias, $options);
         $view = View::create($contentNavigationItems);
     } catch (ContentNavigationAliasNotFoundException $exc) {
         $restException = new RestException($exc->getMessage(), 0, $exc);
         $view = View::create($restException->toArray(), 404);
     } catch (RestException $exc) {
         $view = View::create($exc->toArray(), 400);
     }
     return $this->viewHandler->handle($view);
 }
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  * @dataProvider getCallbackFailureDataProvider
  */
 public function testGetCallbackFailure(Request $request)
 {
     $data = ['foo' => 'bar'];
     $viewHandler = new ViewHandler(['jsonp' => false]);
     $jsonpHandler = new JsonpHandler('callback');
     $viewHandler->registerHandler('jsonp', [$jsonpHandler, 'createResponse']);
     $viewHandler->setSerializationContextAdapter($this->getMock(SerializationContextAdapterInterface::class));
     $container = $this->getMock(ContainerInterface::class);
     $serializer = $this->getMock('stdClass', ['serialize', 'setVersion']);
     $serializer->expects($this->once())->method('serialize')->will($this->returnValue(var_export($data, true)));
     $container->expects($this->any())->method('get')->with($this->equalTo('fos_rest.serializer'))->will($this->returnValue($serializer));
     $container->expects($this->any())->method('getParameter')->will($this->onConsecutiveCalls('version', '1.0'));
     $viewHandler->setContainer($container);
     $data = ['foo' => 'bar'];
     $view = new View($data);
     $view->setFormat('jsonp');
     $viewHandler->handle($view, $request);
 }
 /**
  * Determines the parameters to pass to the view layer.
  *
  * Overwrite it in a custom ExceptionController class to add additionally parameters
  * that should be passed to the view layer.
  *
  * @param ViewHandler                                $viewHandler
  * @param string                                     $currentContent
  * @param int                                        $code
  * @param HttpFlattenException|DebugFlattenException $exception
  * @param DebugLoggerInterface                       $logger
  * @param string                                     $format
  *
  * @return array
  */
 protected function getParameters(ViewHandler $viewHandler, $currentContent, $code, $exception, DebugLoggerInterface $logger = null, $format = 'html')
 {
     $parameters = array('status' => 'error', 'status_code' => $code, 'status_text' => array_key_exists($code, Response::$statusTexts) ? Response::$statusTexts[$code] : "error", 'currentContent' => $currentContent, 'message' => $this->getExceptionMessage($exception), 'exception' => $exception);
     /*
      * Extra info for ApiExceptions
      */
     if ($exception instanceof ApiExceptionInterface) {
         $parameters['id'] = $exception->getId();
         $parameters['info'] = $exception->getInfo();
         $parameters['category'] = $exception->getCategory();
         $parameters['errors'] = $exception->getErrors();
     }
     if ($viewHandler->isFormatTemplating($format)) {
         $parameters['logger'] = $logger;
     }
     return $parameters;
 }
示例#21
0
 public function createRedirectResponse(View $view, $location, $format)
 {
     if ($format == 'html' && $view->getData() != null && ($view->getStatusCode() == Codes::HTTP_CREATED || $view->getStatusCode() == Codes::HTTP_ACCEPTED)) {
         $prevStatus = $view->getStatusCode();
         $view->setStatusCode(Codes::HTTP_OK);
     }
     $response = parent::createRedirectResponse($view, $location, $format);
     if ($response->headers->has('Location') && $response->getStatusCode() !== Codes::HTTP_CREATED && ($response->getStatusCode() < 300 || $response->getStatusCode() >= 400)) {
         $response->headers->remove('Location');
     }
     if (isset($prevStatus)) {
         $view->setStatusCode($prevStatus);
         $code = isset($this->forceRedirects[$format]) ? $this->forceRedirects[$format] : $this->getStatusCode($view, $response->getContent());
         $response->setStatusCode($code);
     }
     return $response;
 }
示例#22
0
 /**
  * trigger a action for given snippet specified over get-action parameter.
  *
  * @Post("/snippets/{uuid}")
  *
  * @param string $uuid
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function postTriggerAction($uuid, Request $request)
 {
     $view = null;
     $snippet = null;
     $this->initEnv($request);
     $action = $this->getRequestParameter($request, 'action', true);
     try {
         switch ($action) {
             case 'copy-locale':
                 $destLocale = $this->getRequestParameter($request, 'dest', true);
                 // call repository method
                 $snippet = $this->snippetRepository->copyLocale($uuid, $this->getUser()->getId(), $this->languageCode, explode(',', $destLocale));
                 break;
             default:
                 throw new RestException('Unrecognized action: ' . $action);
         }
         // prepare view
         $view = View::create($this->decorateSnippet($snippet->toArray(), $this->languageCode), $snippet !== null ? 200 : 204);
     } catch (RestException $exc) {
         $view = View::create($exc->toArray(), 400);
     }
     return $this->viewHandler->handle($view);
 }
 /**
  * @dataProvider prepareTemplateParametersDataProvider
  */
 public function testPrepareTemplateParametersWithProvider($viewData, $expected)
 {
     $handler = new ViewHandler();
     $view = new View();
     $view->setData($viewData);
     $this->assertEquals($expected, $handler->prepareTemplateParameters($view));
 }
示例#24
0
 private function handleView($document)
 {
     $view = View::create($document);
     $view->setSerializationContext(SerializationContext::create()->setSerializeNull(true));
     return $this->viewHandler->handle($view);
 }
 /**
  * @param View $view
  *
  * @return Response
  */
 protected function handle(View $view)
 {
     return $this->viewHandler->handle($view);
 }
示例#26
0
 /**
  * @dataProvider exceptionWrapperSerializeResponseContentProvider
  * @param string $format
  */
 public function testCreateResponseWithFormErrorsAndSerializationGroups($format)
 {
     $form = Forms::createFormFactory()->createBuilder()->add('name', 'text')->add('description', 'text')->getForm();
     $form->get('name')->addError(new FormError('Invalid name'));
     $exceptionWrapper = new ExceptionWrapper(array('status_code' => 400, 'message' => 'Validation Failed', 'errors' => $form));
     $view = new View($exceptionWrapper);
     $view->getSerializationContext()->setGroups(array('Custom'));
     $wrapperHandler = new ExceptionWrapperSerializeHandler();
     $translatorMock = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface', array('trans', 'transChoice', 'setLocale', 'getLocale'));
     $translatorMock->expects($this->any())->method('trans')->will($this->returnArgument(0));
     $formErrorHandler = new FormErrorHandler($translatorMock);
     $serializer = SerializerBuilder::create()->configureHandlers(function (HandlerRegistry $handlerRegistry) use($wrapperHandler, $formErrorHandler) {
         $handlerRegistry->registerSubscribingHandler($wrapperHandler);
         $handlerRegistry->registerSubscribingHandler($formErrorHandler);
     })->build();
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', array('get'));
     $container->expects($this->once())->method('get')->with('fos_rest.serializer')->will($this->returnValue($serializer));
     $viewHandler = new ViewHandler(array());
     $viewHandler->setContainer($container);
     $response = $viewHandler->createResponse($view, new Request(), $format);
     $serializer2 = SerializerBuilder::create()->configureHandlers(function (HandlerRegistry $handlerRegistry) use($wrapperHandler, $formErrorHandler) {
         $handlerRegistry->registerSubscribingHandler($formErrorHandler);
     })->build();
     $container2 = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', array('get'));
     $container2->expects($this->once())->method('get')->with('fos_rest.serializer')->will($this->returnValue($serializer2));
     $viewHandler = new ViewHandler(array());
     $viewHandler->setContainer($container2);
     $view2 = new View($exceptionWrapper);
     $response2 = $viewHandler->createResponse($view2, new Request(), $format);
     $this->assertEquals($response->getContent(), $response2->getContent());
 }
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function testHandleNotSupported()
 {
     $viewHandler = new ViewHandler(array());
     $container = $this->getMock('\\Symfony\\Component\\DependencyInjection\\Container', array('get'));
     $container->expects($this->once())->method('get')->with('request')->will($this->returnValue(new Request()));
     $viewHandler->setContainer($container);
     $data = array('foo' => 'bar');
     $view = new View($data);
     $viewHandler->handle($view);
 }
示例#28
0
 /**
  * Return a JSON encoded scalar array of index names.
  *
  * @return JsonResponse
  */
 public function categoriesAction()
 {
     return $this->viewHandler->handle(View::create($this->searchManager->getCategoryNames()));
 }
示例#29
0
 /**
  * Determine the parameters to pass to the view layer.
  *
  * Overwrite it in a custom ExceptionController class to add additionally parameters
  * that should be passed to the view layer.
  *
  * @param ViewHandler                                       $viewHandler    The view handler instance
  * @param string                                            $currentContent The current content in the output buffer
  * @param integer                                           $code           An HTTP response code
  * @param HttpFlattenException|DebugFlattenException        $exception      A HttpFlattenException|DebugFlattenException instance
  * @param DebugLoggerInterface                              $logger         A DebugLoggerInterface instance
  * @param string                                            $format         The format to use for rendering (html, xml, ...)
  *
  * @return array Template parameters
  */
 protected function getParameters(ViewHandler $viewHandler, $currentContent, $code, $exception, DebugLoggerInterface $logger = null, $format = 'html')
 {
     $parameters = array('status' => 'error', 'status_code' => $code, 'status_text' => array_key_exists($code, Response::$statusTexts) ? Response::$statusTexts[$code] : "error", 'currentContent' => $currentContent, 'message' => $this->getExceptionMessage($exception));
     if ($viewHandler->isFormatTemplating($format)) {
         $parameters['exception'] = $exception;
         $parameters['logger'] = $logger;
     }
     return $parameters;
 }
示例#30
0
 /**
  * @dataProvider exceptionWrapperSerializeResponseContentProvider
  *
  * @param string $format
  */
 public function testCreateResponseWithFormErrorsAndSerializationGroups($format)
 {
     $form = Forms::createFormFactory()->createBuilder()->add('name', 'text')->add('description', 'text')->getForm();
     $form->get('name')->addError(new FormError('Invalid name'));
     $exceptionWrapper = new ExceptionWrapper(['status_code' => 400, 'message' => 'Validation Failed', 'errors' => $form]);
     $view = new View($exceptionWrapper);
     $view->getSerializationContext()->addGroups(['Custom']);
     $wrapperHandler = new ExceptionWrapperSerializeHandler();
     $translatorMock = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface', ['trans', 'transChoice', 'setLocale', 'getLocale']);
     $translatorMock->expects($this->any())->method('trans')->will($this->returnArgument(0));
     $formErrorHandler = new FormErrorHandler($translatorMock);
     $serializer = SerializerBuilder::create()->configureHandlers(function (HandlerRegistry $handlerRegistry) use($wrapperHandler, $formErrorHandler) {
         $handlerRegistry->registerSubscribingHandler($wrapperHandler);
         $handlerRegistry->registerSubscribingHandler($formErrorHandler);
     })->build();
     $adapter = $this->getMock('FOS\\RestBundle\\Context\\Adapter\\SerializationContextAdapterInterface');
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', ['get']);
     $container->expects($this->any())->method('get')->with($this->logicalOr($this->equalTo('fos_rest.serializer'), $this->equalTo('fos_rest.context.adapter.chain_context_adapter')))->will($this->returnCallback(function ($method) use($serializer, $adapter) {
         switch ($method) {
             case 'fos_rest.serializer':
                 return $serializer;
             case 'fos_rest.context.adapter.chain_context_adapter':
                 return $adapter;
         }
     }));
     $viewHandler = new ViewHandler([]);
     $viewHandler->setSerializationContextAdapter($this->getMock('FOS\\RestBundle\\Context\\Adapter\\SerializationContextAdapterInterface'));
     $viewHandler->setContainer($container);
     $response = $viewHandler->createResponse($view, new Request(), $format);
     $serializer2 = SerializerBuilder::create()->configureHandlers(function (HandlerRegistry $handlerRegistry) use($wrapperHandler, $formErrorHandler) {
         $handlerRegistry->registerSubscribingHandler($formErrorHandler);
     })->build();
     $container2 = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', ['get']);
     $container2->expects($this->any())->method('get')->with($this->logicalOr($this->equalTo('fos_rest.serializer'), $this->equalTo('fos_rest.context.adapter.chain_context_adapter')))->will($this->returnCallback(function ($method) use($serializer2, $adapter) {
         switch ($method) {
             case 'fos_rest.serializer':
                 return $serializer2;
             case 'fos_rest.context.adapter.chain_context_adapter':
                 return $adapter;
         }
     }));
     $viewHandler = new ViewHandler([]);
     $viewHandler->setSerializationContextAdapter($this->getMock('FOS\\RestBundle\\Context\\Adapter\\SerializationContextAdapterInterface'));
     $viewHandler->setContainer($container2);
     $view2 = new View($exceptionWrapper);
     $response2 = $viewHandler->createResponse($view2, new Request(), $format);
     $this->assertEquals($response->getContent(), $response2->getContent());
 }