public function setup()
{
parent::setup();
$config = (include 'config/application.config.php');
$config['module_listener_options']['config_static_paths'] = array(getcwd() . '/config/test.config.php');
if (file_exists(__DIR__ . '/config/test.config.php')) {
$moduleConfig = (include __DIR__ . '/config/test.config.php');
array_unshift($config['module_listener_options']['config_static_paths'], $moduleConfig);
}
$this->serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
$this->serviceManager->setService('ApplicationConfig', $config);
$this->serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
$moduleManager = $this->serviceManager->get('ModuleManager');
$moduleManager->loadModules();
$this->routes = array();
foreach ($moduleManager->getModules() as $m) {
$moduleConfig = (include __DIR__ . '/../../../../' . ucfirst($m) . '/config/module.config.php');
if (isset($moduleConfig['router'])) {
foreach ($moduleConfig['router']['routes'] as $key => $name) {
$this->routes[$key] = $name;
}
}
}
$this->serviceManager->setAllowOverride(true);
$this->application = $this->serviceManager->get('Application');
$this->event = new MvcEvent();
$this->event->setTarget($this->application);
$this->event->setApplication($this->application)->setRequest($this->application->getRequest())->setResponse($this->application->getResponse())->setRouter($this->serviceManager->get('Router'));
$this->createDatabase();
}