Reputation: 1279
I am following this guide http://devblog.x2k.co.uk/getting-the-servicemanager-into-the-test-environment-and-dependency-injection/ to get my phpunit stuff to run.
But after i add this code AS PER according to the tutorial .
$serviceManager->get('ModuleManager')->loadModules();
i get the following error where could not find any clue to resolve !
`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`
Please Help me to resolve this issue.
Upvotes: 0
Views: 859
Reputation: 1279
This issue was resolved after using the Bootstrap provided here.
So Bootstrap used in the above tutorial is the issue behind this problem. finally its solved.
Upvotes: 1