php - ZF2 phpunit URL-ViewHelper -


i want test application. works fine point want test own viewhelpers (actionhelpers). problem is, want use url-viewhelper in own viewhelper generate links.

therefore use statements.

$urlhelper = $servicelocator->getservicelocator()->get('viewhelpermanager')->get('url'); $urlhelper->__invoke('test',array(),array(),true); 

this works great.

but want test parts of application view helper used. works fine point use url_viewhelper.

i following exception:

fatal error: call member function getroutematch() on non-object in ****\vendor\zendframework\zendframework\library\zend\mvc\service\viewhelpermanagerfactory.php on line 70 

is there wrong in way setup test?

$servicemanager = bootstrap::getservicemanager(); $this->controller = new indexcontroller(); $this->request = new request(); $this->routematch = new routematch(array('controller' => 'index')); $this->event = new mvcevent(); $config = $servicemanager->get('config'); $routerconfig = isset($config['router']) ? $config['router'] : array(); $router = httprouter::factory($routerconfig); $this->event->setrouter($router); $this->event->setroutematch($this->routematch); $this->controller->setevent($this->event); $this->controller->setservicelocator($servicemanager); 

thank help!


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -