protected function mockRouter($url) { $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface'); $router->expects($this->any())->method('generate')->willReturn($url); return $router; }