I'm retrieving instances from the ServiceManager by their full class names in some cases, for example:
$someThing = $serviceManager->get('MyModule\Some\Nice\Lib\SomeThing');
This works pretty well for HTTP MVC requests, however, when using phpunit, the ServiceManager can't find it. (It throws a Zend\ServiceManager\Exception\ServiceNotFoundException
exception with message "Zend\ServiceManager\ServiceManager::get
was unable to fetch or create an instance for ...")
I'm using the default testing bootstrap example from the docs and I experience this issue in two different projects on different mashines, so I guess this is a general problem.
My first guess was that it has something to do with MVC or application, becuase this is most likely the only real difference between testing and http. I even dumped the SM instances in both modes and compared them with each other, looked through the sources and searched the web.
Unfortunately, I can't paste any code due to my labor contract. However, as I said, I think this is a general problem so you should be able to easily reproduce it.
Does anybody know what is causing this issue and how to solve it?