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()); }
public function onKernelRequest(KernelEvent $event) { $request = $event->getRequest(); $context = RequestContext::createFromRequest($request); $request->setAttributes($this->router->match($context)); }
public function __construct(callable $controller, Request $request) { parent::__construct($request); $this->controller = $controller; }
public function __construct(\Exception $exception, Request $request, Response $response = null) { parent::__construct($request, $response); $this->exception = $exception; }