/** * Create service. * * @param ServiceLocatorInterface $serviceLocator * * @return QueryUrl */ public function createService(ServiceLocatorInterface $serviceLocator) { $request = $serviceLocator->getServiceLocator()->get('Request'); $helper = new QueryUrl($request); $router = $serviceLocator->getServiceLocator()->get('Router'); $match = $serviceLocator->getServiceLocator()->get('Application')->getMvcEvent()->getRouteMatch(); if ($match instanceof RouteMatch) { $helper->setRouteMatch($match); } $helper->setRouter($router); return $helper; }
/** * @expectedException \LearnZF2Pagination\Exception\RuntimeException */ public function testNoRouterThrowsException() { $helper = new QueryUrl(new Request()); $helper->__invoke('route-name'); }