public function testDoesNotInjectTemplateWhenInModuleNamespace() { $e = new \Zend\Mvc\MvcEvent(); $routerFactory = new \Zend\Mvc\Service\RouterFactory(); $routeMatch = new \Zend\Mvc\Router\Http\RouteMatch(array('__NAMESPACE__' => 'App\\Controller', 'controller' => 'Index', 'action' => 'index')); $routeMatch->setMatchedRouteName('test'); $e->setRouteMatch($routeMatch)->setController('Index')->setControllerClass('App\\Controller\\Index')->setTarget('App\\Controller\\Index')->setResult(new \Zend\View\Model\ViewModel()); $this->listener->injectTemplate($e); $this->assertEquals('', $e->getResult()->getTemplate()); }
/** * Get the custom URL of the Tracking Code * * @return string URL */ protected function getCustomUrl() { $path = $this->request->getUri()->getPath(); $routeMatch = $this->router->match($this->request); if ($routeMatch && $routeMatch->getMatchedRouteName() == 'vufindrecord-ajaxtab') { // Replace 'AjaxTab' with tab name in record page URLs $replace = 'AjaxTab'; $tab = $this->request->getPost('tab'); if (null !== ($pos = strrpos($path, $replace))) { $path = substr_replace($path, $tab, $pos, $pos + strlen($replace)); } } return $path; }
public function getRouteMatch($page, $orderBy = 'idContato', $order = 'DESC') { $routeMatch = new \Zend\Mvc\Router\Http\RouteMatch(array('controller' => 'SandboxContact\\Controller\\Contato', 'action' => 'list', 'page' => $page, 'orderBy' => $orderBy, 'order' => $order)); $routeMatch->setMatchedRouteName('sandbox-contact/contato'); return $routeMatch; }