Ejemplo n.º 1
0
 public function testEventHandlerRequest()
 {
     $eventDispatcher = $this->buildMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $router = new DynamicRouter($this->context, $this->matcher, $this->generator, '', $eventDispatcher);
     $that = $this;
     $eventDispatcher->expects($this->once())->method('dispatch')->with(Events::PRE_DYNAMIC_MATCH_REQUEST, $this->callback(function ($event) use($that) {
         $that->assertInstanceOf('Symfony\\Cmf\\Component\\Routing\\Event\\RouterMatchEvent', $event);
         $that->assertEquals($that->request, $event->getRequest());
         return true;
     }));
     $routeDefaults = array('foo' => 'bar');
     $this->matcher->expects($this->once())->method('match')->with($this->url)->will($this->returnValue($routeDefaults));
     $this->assertEquals($routeDefaults, $router->matchRequest($this->request));
 }
 public function matchRequest(Request $request)
 {
     $defaults = parent::matchRequest($request);
     return $this->cleanDefaults($defaults, $request);
 }