createResponse() public method

public createResponse ( Response $symfonyResponse )
$symfonyResponse Symfony\Component\HttpFoundation\Response
 public function testValidRequestShouldBeHandledByTheNextMiddleware()
 {
     $content = '{"content": "This is the content"}';
     $request = Request::create('http://localhost/', 'GET', [], [], [], [], $content);
     $request->headers->set('X-Hub-Signature', sprintf('sha1=%s', hash_hmac('sha1', $content, 'my_secret')));
     $psrFactory = new DiactorosFactory();
     $foundationFactory = new HttpFoundationFactory();
     $psrRequest = $psrFactory->createRequest($request);
     $expectedRequest = $foundationFactory->createRequest($psrRequest);
     $response = new Response('OK');
     $expectedResponse = $foundationFactory->createResponse($psrFactory->createResponse($response));
     $next = $this->prophesize('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
     $next->handle($expectedRequest)->shouldBeCalledTimes(1)->willReturn($response);
     $middleware = new GitHubWebHook($next->reveal(), 'my_secret');
     $response = $middleware->handle($request);
     $this->assertEquals($expectedResponse, $response);
 }
 /**
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $request = $event->getRequest();
     $response = $event->getResponse();
     if ($request->attributes->has('hmac.key')) {
         $psr7Factory = new DiactorosFactory();
         $foundationFactory = new HttpFoundationFactory();
         $psr7Request = $psr7Factory->createRequest($request);
         $psr7Response = $psr7Factory->createResponse($response);
         $signer = new ResponseSigner($request->attributes->get('hmac.key'), $psr7Request);
         $signedResponse = $signer->signResponse($psr7Response);
         $event->setResponse($foundationFactory->createResponse($signedResponse));
     }
 }
 /**
  * @return Bootstrap
  */
 protected function initHttp()
 {
     $factory = new DiactorosFactory();
     $this->setRequest($this->getContainer()->has(ServerRequestInterface::class) ? $this->getContainer()->get(ServerRequestInterface::class) : $factory->createRequest(Request::createFromGlobals()))->setResponse($this->getContainer()->has(ResponseInterface::class) ? $this->getContainer()->get(ResponseInterface::class) : $factory->createResponse(new Response()));
     return $this;
 }