我正在按照本指南http://devblog.x2k.co.uk/getting-the-servicemanager-into-the-test-environment-and-dependency-injection/来运行我的phpunit。
但是根据教程我将此代码添加为AS PER。
$serviceManager->get('ModuleManager')->loadModules();
我收到以下错误,找不到任何解决方法!
`PHP Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for ModuleManager' in /home/dan/www/d2zfcuser/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:518
Stack trace:
#0 /home/dan/www/d2zfcuser/tests/Bootstrap.php(23): Zend\ServiceManager\ServiceManager->get('ModuleManager')
#1 /home/dan/www/d2zfcuser/tests/Bootstrap.php(32): Bootstrap::init()
#2 /usr/share/php/PHPUnit/Util/Fileloader.php(95): include_once('/home/dan/www/d...')
#3 /usr/share/php/PHPUnit/Util/Fileloader.php(79): PHPUnit_Util_Fileloader::load('/home/dan/www/d...')
#4 /usr/share/php/PHPUnit/TextUI/Command.php(867): PHPUnit_Util_Fileloader::checkAndLoad('/home/dan/www/d...')
#5 /usr/share/php/PHPUnit/TextUI/Command.php(620): PHPUnit_TextUI_Command->handleBootstrap('/home/dan/www/d...')
#6 /usr/share/php/PHPUnit/TextUI/Command.php(139): PHPUnit_TextUI_Command->handleArguments(Array)
#7 /usr/share/php in /home/dan/www/d2zfcuser/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 518`
请帮我解决此问题。