我有一个实现的模型:
\Zend\ServiceManager\ServiceLocatorAwareInterface
该模型依赖于\ configs \ autoload \ global.php中定义的记录器,并通过执行以下操作检索:
$this->getServiceLocator()->get("Zend\Log")
如果我在网页上,这很有用,但在phpunit中,相同的代码会中断消息:
Zend\ServiceManager\Exception\ServiceNotFoundException:
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Zend\Log"
为什么服务管理员在从网上运行时能够获取记录器,而不是从phpunit运行?
Testconfig.php.dist包含:
'module_listener_options' => array(
'config_glob_paths' => array(
'../../../../config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'module',
'vendor',
),
),
答案 0 :(得分:0)
TestConfig.php.dist中的路径错误。应该是
../../../config/autoload/{,*.}{global,local}.php',