Esempio n. 1
0
 public function testStopRequestEvent()
 {
     $request = new Request('GET', '/home', 'HTTP', '1.1');
     $response = Response::createFromRequest($request, '', 200);
     $event = new KernelEvent($request);
     $this->assertSame($request, $event->getRequest());
     $this->assertNull($event->getResponse());
     $this->assertFalse($event->hasResponse());
     $this->assertFalse($event->isStopped());
     $event->setResponse($response);
     $this->assertTrue($event->hasResponse());
     $this->assertSame($response, $event->getResponse());
     $this->assertTrue($event->isStopped());
 }
Esempio n. 2
0
 public function onKernelRequest(KernelEvent $event)
 {
     $request = $event->getRequest();
     $context = RequestContext::createFromRequest($request);
     $request->setAttributes($this->router->match($context));
 }
Esempio n. 3
0
 public function __construct(callable $controller, Request $request)
 {
     parent::__construct($request);
     $this->controller = $controller;
 }
Esempio n. 4
0
 public function __construct(\Exception $exception, Request $request, Response $response = null)
 {
     parent::__construct($request, $response);
     $this->exception = $exception;
 }