Example #1
0
 public function setUp()
 {
     $this->request = new Request();
     $this->helper = new QueryUrl($this->request);
     $this->router = TreeRouteStack::factory(['routes' => ['route-name' => new Literal('/foo/bar')]]);
     $this->helper->setRouter($this->router);
 }
 /**
  * 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;
 }