diff --git a/tests/ZendSkeletonModule/SampleTest.php b/tests/ZendSkeletonModule/SampleTest.php index 0a74792..73a3568 100644 --- a/tests/ZendSkeletonModule/SampleTest.php +++ b/tests/ZendSkeletonModule/SampleTest.php @@ -14,6 +14,6 @@ class SampleTest extends Framework\TestCase public function testSample() { - $this->assertInstanceOf('Zend\Di\LocatorInterface', $this->getLocator()); + $this->assertInstanceOf('Zend\ServiceManager\ServiceLocatorInterface', $this->getLocator()); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6567d48..e8fec9c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -33,7 +33,7 @@ // setup autoloader AutoloaderFactory::factory( array( - 'Zend\Loader\StandardAutoloader' => array( + 'Zend\Loader\StandardAutoloader' => array( StandardAutoloader::AUTOREGISTER_ZF => true, StandardAutoloader::ACT_AS_FALLBACK => false, StandardAutoloader::LOAD_NS => $additionalNamespaces, @@ -62,45 +62,24 @@ $modules = array_merge($modules, $moduleDependencies); } +$config = array( + 'module_listener_options' => array( + 'module_paths' => $modulePaths, + ), + 'modules' => $modules, +); -$listenerOptions = new Zend\ModuleManager\Listener\ListenerOptions(array('module_paths' => $modulePaths)); -$defaultListeners = new Zend\ModuleManager\Listener\DefaultListenerAggregate($listenerOptions); -$sharedEvents = new Zend\EventManager\SharedEventManager(); -$moduleManager = new \Zend\ModuleManager\ModuleManager($modules); -$moduleManager->getEventManager()->setSharedManager($sharedEvents); -$moduleManager->getEventManager()->attachAggregate($defaultListeners); -$moduleManager->loadModules(); +$serviceManager = new \Zend\ServiceManager\ServiceManager( + new \Zend\Mvc\Service\ServiceManagerConfig() +); +$serviceManager->setService('ApplicationConfig', $config); +$serviceManager->get('ModuleManager')->loadModules(); if (method_exists($moduleTestCaseClassname, 'setLocator')) { - $config = $defaultListeners->getConfigListener()->getMergedConfig(); - - $di = new \Zend\Di\Di; - $di->instanceManager()->addTypePreference('Zend\Di\LocatorInterface', $di); - - if (isset($config['di'])) { - $diConfig = new \Zend\Di\Config($config['di']); - $diConfig->configure($di); - } - - $routerDiConfig = new \Zend\Di\Config( - array( - 'definition' => array( - 'class' => array( - 'Zend\Mvc\Router\RouteStackInterface' => array( - 'instantiator' => array( - 'Zend\Mvc\Router\Http\TreeRouteStack', - 'factory' - ), - ), - ), - ), - ) - ); - $routerDiConfig->configure($di); - - call_user_func_array($moduleTestCaseClassname.'::setLocator', array($di)); + call_user_func_array($moduleTestCaseClassname.'::setLocator', array($serviceManager)); } // When this is in global scope, PHPUnit catches exception: // Exception: Zend\Stdlib\PriorityQueue::serialize() must return a string or NULL -unset($moduleManager, $sharedEvents); +unset($serviceManager); +