Exemplo 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());
 }
Exemplo n.º 2
0
 public function onKernelRequest(KernelEvent $event)
 {
     $request = $event->getRequest();
     $context = RequestContext::createFromRequest($request);
     $request->setAttributes($this->router->match($context));
 }