/** * {@inheritDoc} */ public function setUp() { $serviceManager = \DoctrineMongoODMModuleTest\Doctrine\Util\ServiceManagerFactory::getServiceManager(); /* @var $sharedEventManager \Zend\EventManager\SharedEventManagerInterface */ $sharedEventManager = $serviceManager->get('SharedEventManager'); /* @var $application \Zend\Mvc\Application */ $application = $serviceManager->get('Application'); $invocations = 0; $sharedEventManager = $application->getEventManager()->getSharedManager(); $sharedEventManager->attach('doctrine', 'loadCli.post', function () use(&$invocations) { $invocations += 1; }); $application->bootstrap(); $this->entityManager = $serviceManager->get('doctrine.documentmanager.odm_default'); $this->cli = $serviceManager->get('doctrine.cli'); $this->assertSame(1, $invocations); }
<?php $applicationRoot = __DIR__ . '/../../../../'; chdir($applicationRoot); $loader = (require_once 'vendor/autoload.php'); $loader->add('DoctrineMongoODMModuleTest', __DIR__); $config = (include __DIR__ . '/test.application.config.php'); \DoctrineMongoODMModuleTest\Doctrine\Util\ServiceManagerFactory::setConfig($config); \DoctrineMongoODMModuleTest\AbstractTest::setApplicationConfig($config);