Esempio n. 1
0
 public function setup()
 {
     parent::setup();
     $pathDir = getcwd() . "/";
     $config = (include $pathDir . 'config/application.config.php');
     $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();
     $this->modules = $moduleManager->getModules();
     foreach ($this->filterModules() as $m) {
         $moduleConfig = (include $pathDir . 'module/' . 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->em = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     foreach ($this->filterModules() as $m) {
         $this->createDatabase($m);
     }
 }
Esempio n. 2
0
 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();
 }
 protected function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../../../config/application.config.php');
     $this->sm = $this->getApplicationServiceLocator();
     $this->sm->setAllowOverride(true);
     $this->serializer = $this->getApplicationServiceLocator()->get('serializer');
 }
Esempio n. 4
0
 /**
  * @covers Zend\ServiceManager\ServiceManager::setAllowOverride
  * @covers Zend\ServiceManager\ServiceManager::getAllowOverride
  */
 public function testAllowOverride()
 {
     $this->assertFalse($this->serviceManager->getAllowOverride());
     $ret = $this->serviceManager->setAllowOverride(true);
     $this->assertSame($this->serviceManager, $ret);
     $this->assertTrue($this->serviceManager->getAllowOverride());
 }
 /**
  * Set service to service locator
  *
  * @param string $name
  * @param object $object
  *
  * @return ServiceManager
  */
 protected function setMockToServiceLocator($name, $object)
 {
     if (!$this->serviceLocator) {
         $this->serviceLocator = $this->getApplicationServiceLocator();
         $this->serviceLocator->setAllowOverride(true);
     }
     $this->serviceLocator->setService($name, $object);
     return $this->serviceLocator;
 }
Esempio n. 6
0
 /**
  * Listen for theme change and override Config.
  */
 public function reloadConfig()
 {
     $request = $this->service->get('Request');
     $config = $this->service->get('Config');
     $this->service->setAllowOverride(true);
     $config['theme']['name'] = $request->getPost()['themeName'];
     $this->service->setService('Config', $config);
     $this->service->setAllowOverride(false);
 }
 public function setUp()
 {
     $this->serviceLocator = null;
     $this->setApplicationConfig(Bootstrap::getConfig());
     parent::setUp();
     if (!is_object($this->serviceLocator)) {
         $this->serviceLocator = $this->getApplicationServiceLocator();
         $this->serviceLocator->setAllowOverride(true);
     }
 }
Esempio n. 8
0
 public function testViewFactoryAllowsConfiguringViewHelpers()
 {
     $config = ['view_manager' => ['template_path_stack' => [__DIR__ . '/../view']], 'view_helpers' => ['invokables' => ['foo' => FooHelper::class]]];
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('Configuration', array_merge($this->getSmConfig(), $config));
     $view = $this->serviceManager->get(View::class);
     $vm = new ViewModel();
     $vm->setTemplate('helper-test.phtml');
     $result = $view->render($vm);
     $this->assertEquals('FOOBAR', $result);
 }
Esempio n. 9
0
 public static function getServiceManager()
 {
     // configure service manager
     $configuration = static::$serviceConfig ?: (require __DIR__ . '/../../../test.application.on.config.php');
     $serviceManager = new ZendServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $configuration);
     $serviceManager->get('ModuleManager')->loadModules();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('request', Request::getRequest());
     $serviceManager->setAllowOverride(false);
     return $serviceManager;
 }
 /**
  * Setup the service manager
  */
 protected function setUp()
 {
     $this->serviceConfig = (require TEST_BASE_PATH . '/config/module.config.php');
     $this->serviceManager = new ServiceManager();
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('Config', $this->serviceConfig);
     $this->serviceManager->setService('custom.strategy', $this->getMock('Zend\\Stdlib\\Hydrator\\Strategy\\StrategyInterface'));
     $this->serviceManager->setService('custom.filter', $this->getMock('\\Zend\\Stdlib\\Hydrator\\Filter\\FilterInterface'));
     $this->serviceManager->setService('custom.naming_strategy', $this->getMock('Zend\\Stdlib\\Hydrator\\NamingStrategy\\NamingStrategyInterface'));
     $this->hydratorManager = $this->getMock('Zend\\Stdlib\\Hydrator\\HydratorPluginManager');
     $this->hydratorManager->expects($this->any())->method('getServiceLocator')->will($this->returnValue($this->serviceManager));
 }
Esempio n. 11
0
 /**
  * @return \Zend\ServiceManager\ServiceManager
  */
 protected function getServiceManager()
 {
     if (null === $this->serviceManager) {
         $configuration = self::$applicationConfig;
         $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
         $this->serviceManager = new ServiceManager(new ServiceManagerConfig($smConfig));
         $this->serviceManager->setAllowOverride(true);
         $this->serviceManager->setService('ApplicationConfig', $configuration);
         $this->serviceManager->get('ModuleManager')->loadModules();
     }
     return $this->serviceManager;
 }
Esempio n. 12
0
 /**
  * Issue #80
  *
  * @test
  */
 public function renderDropDownMenu()
 {
     $spiffyNavStub = $this->getMockBuilder('SpiffyNavigation\\View\\Helper\\NavigationMenu')->disableOriginalConstructor()->getMock();
     $spiffyNavStub->expects($this->any())->method('renderMenu')->will($this->returnValue('<ul><li><ul><li>one</li><li>two</li></ul></li><li><ul><li>one</li><li>two</li></ul></li></ul>'));
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('navigationMenu', $spiffyNavStub);
     $service = $this->serviceManager->get('navigationMenu');
     try {
         $this->helper->setNavigationMenu($spiffyNavStub)->renderDropDownMenu('test');
     } catch (\PHPUnit_Framework_Error_Warning $e) {
         $this->fail($e->getMessage());
     }
     $this->assertContains('<b class="caret"></b>', $this->helper->setNavigationMenu($spiffyNavStub)->renderDropDownMenu('test'));
 }
Esempio n. 13
0
 protected function setUpController(\Zend\Mvc\Controller\AbstractActionController $controller)
 {
     $config = (include 'config/application.config.php');
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $serviceManager->setAllowOverride(true);
     $this->controller = $controller;
     $this->request = new Request();
     $this->response = new Response();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $this->event->setRequest($this->request)->setResponse($this->response);
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $this->setupForwardPlugin();
     $this->setupParamsPlugin();
     $this->setupFormPlugin();
     $this->setupGridControllerPlugin();
     $this->setupControllerFilePlugin();
 }
Esempio n. 14
0
 public function createServer($name = 'default')
 {
     Console::overrideIsConsole(false);
     $configuration = $this->configuration;
     $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
     $serviceManager = new ServiceManager(new ServiceManagerConfig($smConfig));
     $serviceManager->setService('ApplicationConfig', $configuration);
     $serviceManager->get('ModuleManager')->loadModules();
     $application = new Application($configuration, $serviceManager);
     $application->setServerOptions($this->options->getServer($name));
     $allow = $serviceManager->getAllowOverride();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('application', $application);
     $serviceManager->setAllowOverride($allow);
     return $application->bootstrap();
 }
Esempio n. 15
0
 public static function init()
 {
     /**
      * Load Test Config to include other modules we require
      */
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     \Zend\Mvc\Application::init($config);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
     static::$config = $config;
 }
 /**
  * @expectedException \Zend\ServiceManager\Exception\ServiceNotCreatedException
  */
 public function testWillThrowExceptionOnInvalidAlternateTwilioController()
 {
     $config = $this->services->get('Config');
     $config['synrg-twilio']['TestController']['controller_class'] = 'stdClass';
     $this->services->setAllowOverride(true);
     $this->services->setService('Config', $config);
     $this->controllers->get('TestController');
 }
 /**
  * Create a service manager/locator object for tests that need access to service registry
  *
  * @return ServiceManager
  */
 public function getServiceLocator()
 {
     $config = OpenCloudModule::getModuleConfig();
     $manager = new ServiceManager(new Config($config['service_manager']));
     $manager->setAllowOverride(true);
     $manager->setService('config', $this->getRackspaceConfig());
     return $manager;
 }
 public function getServiceManager()
 {
     $services = bootstrap::getServiceManager();
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('ApplicationConfig', $services->get('ApplicationConfig'));
     $serviceManager->get('ModuleManager')->loadModules();
     return $serviceManager;
 }
 /**
  * @covers Zend\ServiceManager\ServiceManager::get
  */
 public function testDuplicateNewInstanceMultipleAbstractFactories()
 {
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setShareByDefault(false);
     $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\BarAbstractFactory');
     $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory');
     $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar'));
     $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar'));
 }
Esempio n. 20
0
 /**
  * @expectedException Zend\ServiceManager\Exception\InvalidServiceNameException
  */
 public function testAssignAliasWithExistingServiceName()
 {
     $this->serviceManager->setFactory('foo', 'ZendTest\\ServiceManager\\TestAsset\\FooFactory');
     $this->serviceManager->setFactory('bar', function ($sm) {
         return new Bar(array('a'));
     });
     $this->serviceManager->setAllowOverride(false);
     // should throw an exception because 'foo' already exists in the service manager
     $this->serviceManager->setAlias('foo', 'bar');
 }
Esempio n. 21
0
 public function testFactory()
 {
     $serviceManager = new ServiceManager();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService(BlockPoolInterface::class, new BlockPool());
     $serviceManager->setService(LayoutUpdaterInterface::class, new LayoutUpdater());
     $serviceManager->setService(ModuleOptions::class, new ModuleOptions());
     $factory = new LayoutFactory();
     $instance = $factory->createService($serviceManager);
     $this->assertInstanceOf(LayoutInterface::class, $instance);
 }
Esempio n. 22
0
 public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/config/testConfig.php')) {
         $testConfig = (include __DIR__ . '/config/testConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = [];
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = ['module_listener_options' => ['module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)]];
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $serviceManager->setService('Log\\App', new Logger(['writers' => [['name' => 'stream', 'priority' => 1000, 'options' => ['stream' => __DIR__ . '/config/app.log'], 'filter' => Logger::DEBUG]]]));
     $client = $serviceManager->get(Sdk::class);
     try {
         // Check the client is configure
         $dynamodbClient = $client->createDynamoDb();
     } catch (\InvalidArgumentException $e) {
         // If the client is not configure, we create a mock one
         $dynamodbClient = Mockery::mock(DynamoDbClient::class);
         // And we load mock
         $mocks = (include __DIR__ . '/config/AwsFixture.php');
         foreach ($mocks as $key => $item) {
             foreach ($item as $mock) {
                 $request = $mock['request'];
                 // We mock every expected request with the according response
                 $on = Mockery::on(function ($value) use($request) {
                     return $value === $request;
                 });
                 $dynamodbClient->shouldReceive('createTable')->with($on)->andReturn($mock['response']);
             }
         }
         $serviceManager->setAllowOverride(true);
         $client = Mockery::mock('\\Aws\\DynamoDb\\DynamoDbClient');
         $client->shouldReceive('createDynamoDb')->andReturn($dynamodbClient);
         $serviceManager->setService(Sdk::class, $client);
     }
     static::$serviceManager = $serviceManager;
     static::$config = $config;
 }
Esempio n. 23
0
 public function testFactory()
 {
     $serviceManager = new ServiceManager();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('ConLayout\\Block\\Factory\\BlockFactoryInterface', new BlockFactory());
     $serviceManager->setService('ConLayout\\Updater\\LayoutUpdaterInterface', new LayoutUpdater());
     $serviceManager->setService('ConLayout\\Options\\ModuleOptions', new ModuleOptions());
     $factory = new LayoutFactory();
     $instance = $factory->createService($serviceManager);
     $this->assertInstanceOf('ConLayout\\Layout\\LayoutInterface', $instance);
 }
Esempio n. 24
0
 /**
  * @dataProvider duplicateService
  */
 public function testWithAllowOverrideOnRegisteringAServiceDuplicatingAnExistingAliasShouldInvalidateTheAlias($method, $service, $expected, $assertion = 'assertSame')
 {
     $this->serviceManager->setAllowOverride(true);
     $sm = $this->serviceManager;
     $this->serviceManager->setFactory('http.response', function () use($sm) {
         return $sm;
     });
     $this->serviceManager->setAlias('response', 'http.response');
     $this->assertSame($sm, $this->serviceManager->get('response'));
     $this->serviceManager->{$method}('response', $service);
     $this->{$assertion}($expected, $this->serviceManager->get('response'));
 }
Esempio n. 25
0
 protected static function initServiceManager()
 {
     $baseConfig = array('modules' => ['ConLayout'], 'module_listener_options' => array('module_paths' => [dirname(__DIR__)]));
     $config = $baseConfig;
     $serviceManager = new ServiceManager();
     $serviceManager->setAllowOverride(true);
     $smConfig = new ServiceManagerConfig();
     $smConfig->configureServiceManager($serviceManager);
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
 }
 /**
  * Retrieves a new ServiceManager instance
  *
  * @param  array|null     $configuration
  * @return ServiceManager
  */
 public function getServiceManager(array $configuration = null)
 {
     $configuration = $configuration ?: static::getConfiguration();
     $serviceManager = new ServiceManager(new ServiceManagerConfig(isset($configuration['service_manager']) ? $configuration['service_manager'] : array()));
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('ApplicationConfig', $configuration);
     $serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
     /* @var $moduleManager \Zend\ModuleManager\ModuleManagerInterface */
     $moduleManager = $serviceManager->get('ModuleManager');
     $moduleManager->loadModules();
     return $serviceManager;
 }
Esempio n. 27
0
 /**
  * @covers Zend\ServiceManager\ServiceManager::resolveAlias
  */
 public function testSetCircularAliasReferenceThrowsException()
 {
     $this->setExpectedException('Zend\\ServiceManager\\Exception\\CircularReferenceException');
     // Only affects service managers that allow overwriting definitions
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setInvokableClass('foo-service', 'stdClass');
     $this->serviceManager->setAlias('foo-alias', 'foo-service');
     $this->serviceManager->setAlias('bar-alias', 'foo-alias');
     $this->serviceManager->setAlias('baz-alias', 'bar-alias');
     // This will now cause a cyclic reference and should throw an exception
     $this->serviceManager->setAlias('foo-alias', 'bar-alias');
 }
 /**
  * @depends testToString
  */
 public function testSetLocaleFromConfig(DefaultLocale $default)
 {
     $sm = new ServiceManager();
     $sm->setAllowOverride(true);
     $sm->setService('config', array('locale' => 'en_GB'));
     $this->assertSame($default, $default->setLocaleFromConfig($sm));
     $this->assertSame('en_GB', $default->getLocale());
     $sm->setService('config', array('locale' => 'en_US'));
     $default->setLocaleFromConfig($sm);
     $this->assertSame('en_US', $default->getLocale());
     return $default;
 }
Esempio n. 29
0
 public function testWillFetchDiDependenciesFromControllerLoaderServiceManager()
 {
     $controllerName = __NAMESPACE__ . '\\TestAsset\\ControllerWithDependencies';
     // rewriting since controller loader does not have the correct config, but is already fetched
     $config = new ArrayObject(array('di' => array('instance' => array($controllerName => array('parameters' => array('injected' => 'stdClass'))), 'allowed_controllers' => array($controllerName))));
     $this->services->setAllowOverride(true);
     $this->services->setService('Config', $config);
     $this->loader = $this->services->get('ControllerLoader');
     $testService = new \stdClass();
     $this->services->setService('stdClass', $testService);
     // invalid controller exception (because we're not getting a \Zend\Stdlib\DispatchableInterface after all)
     $controller = $this->loader->get($controllerName);
     $this->assertSame($testService, $controller->injectedValue);
 }
Esempio n. 30
0
 /**
  * Faz o setup dos testes. Executado antes de cada teste
  * @return void
  */
 public function setup()
 {
     $env = getenv('ENV');
     //o jenkins tem configurações especiais
     if (!$env || $env != 'jenkins') {
         putenv("ENV=testing");
         $env = 'testing';
     }
     putenv('PROJECT_ROOT=' . __DIR__ . '/../../../../../');
     parent::setup();
     //arquivo de configuração da aplicação
     $config = (include __DIR__ . '/../../../../../config/tests.config.php');
     $config['module_listener_options']['config_static_paths'] = array();
     //cria um novo ServiceManager
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
     //configura os serviços básicos no ServiceManager
     $this->serviceManager->setService('ApplicationConfig', $config);
     $this->serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
     //verifica se os módulos possuem rotas configuradas e carrega elas para serem usadas pelo ControllerTestCase
     $moduleManager = $this->serviceManager->get('ModuleManager');
     $moduleManager->loadModules();
     $this->routes = array();
     $testConfig = false;
     //carrega as rotas dos módulos
     foreach ($moduleManager->getLoadedModules() as $m) {
         $moduleConfig = $m->getConfig();
         $this->getModuleRoutes($moduleConfig);
         $moduleName = explode('\\', get_class($m));
         $moduleName = $moduleName[0];
         //verifica se existe um arquivo de configuração específico no módulo para testes
         if (file_exists(getcwd() . '/module/' . ucfirst($moduleName) . '/config/test.config.php')) {
             $testConfig = (include getcwd() . '/module/' . ucfirst($moduleName) . '/config/test.config.php');
             array_unshift($config['module_listener_options']['config_static_paths'], $testConfig[$env]);
         }
     }
     if (!$testConfig) {
         $config['module_listener_options']['config_static_paths'] = array(getcwd() . '/config/tests.config.php');
     }
     $this->config = (include $config['module_listener_options']['config_static_paths'][0]);
     $this->serviceManager->setAllowOverride(true);
     //instancia a aplicação e configura os eventos e rotas
     $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->entityManager = $this->getEntityManager();
     $this->dropDatabase();
     $this->createDatabase();
 }