zend-mvc
zend-mvc copied to clipboard
ViewHelperManager Service cannot be created outside Application context
This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7191 User: @boukeversteegh Created On: 2015-02-06T13:54:40Z Updated At: 2015-02-06T14:20:45Z Body To Bootstrap my unit tests, I had to use the ViewHelperManager to hydrate some entities (with zf-hal) and insert them in my ElasticSearch database, however since there is no Route and MvcEvent at this point, the following error occurred:
PHP Fatal error: Call to a member function getRouteMatch() on null in
/var/www/app/vendor/zendframework/zendframework/library/Zend/Mvc/Service/ViewHelperManagerFactory.php on line 70
Comment
User: @stefanotorresi
Created On: 2015-02-06T14:20:45Z
Updated At: 2015-02-06T14:20:45Z
Body
The factory is meant to be used within an initialized Zend\Mvc\Application. In your test, either set up a test application running init() explicitly with a mock config, or override the url plugin factory.
This repository has been closed and moved to laminas/laminas-mvc; a new issue has been opened at https://github.com/laminas/laminas-mvc/issues/26.