I got the error below in PHPUnit Controller test in Zend Framework 3:
Exception 'Zend\\ServiceManager\\Exception\\ServiceNotCreatedException' with message 'Service with name "Zend\\Db\\Adapter\\AdapterInterface" could not be created.
The same tests were working fine in Zend Framework 2. The following method in TestController is causing the issue.
$this->configureServiceManager($this->getApplicationServiceLocator());
is it deprecated?
After 4 days, I was able to figure out the problem and the fix.
protected function updateConfig($config)
{
$config['db'] = [];
$config['db']['driver'] = 'Pdo';
return $config;
}
I had to the driver manually to fix the issue, Hope it will help others with the same error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.