handle() public method

public handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
$request Symfony\Component\HttpFoundation\Request
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     $masterRequest = HttpKernelInterface::MASTER_REQUEST === $type ? $request : $this->container->get('request');
     $this->container->set('request', $request);
     $response = parent::handle($request, $type, $catch);
     $this->container->set('request', $masterRequest);
     return $response;
 }
Ejemplo n.º 2
0
 public function testHandleWithAResponseListener()
 {
     $dispatcher = new EventDispatcher();
     $dispatcher->connect('core.response', function ($event, $response) {
         return new Response('foo');
     });
     $kernel = new BaseHttpKernel($dispatcher, $this->getResolver());
     $this->assertEquals('foo', $kernel->handle(new Request())->getContent());
 }