public function testEventHandler() { $eventDispatcher = $this->buildMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $router = new DynamicRouter($this->context, $this->matcher, $this->generator, '', $eventDispatcher); $eventDispatcher->expects($this->once())->method('dispatch')->with(Events::PRE_DYNAMIC_MATCH, $this->equalTo(new RouterMatchEvent())); $routeDefaults = array('foo' => 'bar'); $this->matcher->expects($this->once())->method('match')->with($this->url)->will($this->returnValue($routeDefaults)); $this->assertEquals($routeDefaults, $router->match($this->url)); }
/** * Put content and template name into the request attributes instead of the * route defaults. * * {@inheritDoc} * * The match should identify a controller for symfony. This can either be * the fully qualified class name or the service name of a controller that * is registered as a service. In both cases, the action to call on that * controller is appended, separated with two colons. */ public function match($url) { $defaults = parent::match($url); return $this->cleanDefaults($defaults); }