container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); $this->dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); $this->container->set("event_dispatcher", $this->dispatcher); $this->setupURLTool(); } protected function setupURLTool() { $context = new RequestContext( '/thelia/index.php', 'GET', 'localhost', 'http', 80, 443, '/path/to/action' ); $router = $this->getMockBuilder("Symfony\Component\Routing\Router") ->disableOriginalConstructor() ->getMock(); $router->expects($this->any()) ->method('getContext') ->will($this->returnValue($context)); $this->container->set("router.admin", $router); new URL($this->container); } public function getContainer() { return $this->container; } public function getDispatcher() { return $this->dispatcher; } /** * @return EventDispatcherInterface */ protected function getMockEventDispatcher() { return $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); } }