public function setUp() { parent::setUp(); $this->createDb(); $loader = new FixtureLoader(); $loader->addFixture(new TestFixture()); $purger = new ORMPurger(); $executor = new ORMExecutor($this->getEntityManager(), $purger); $executor->execute($loader->getFixtures()); $this->element = new DoctrineEntityElement('foo', array('object_manager' => $this->getEntityManager(), 'target_class' => 'DoctrineORMModuleTest\\Assets\\Entity\\Test')); }
public function setUp() { parent::setUp(); $this->createDb(); $loader = new FixtureLoader(); $loader->addFixture(new TestFixture()); $purger = new ORMPurger(); $executor = new ORMExecutor($this->getEntityManager(), $purger); $executor->execute($loader->getFixtures()); $this->hydrator = new DoctrineEntityHydrator($this->getEntityManager()); }
public function setUp() { parent::setUp(); $this->createDb(); $loader = new FixtureLoader(); $loader->addFixture(new TestFixture()); $purger = new ORMPurger(); $executor = new ORMExecutor($this->getEntityManager(), $purger); $executor->execute($loader->getFixtures()); $this->qb = $this->getEntityManager()->createQueryBuilder()->select('t')->from('DoctrineORMModuleTest\\Assets\\Entity\\Test', 't')->orderBy('t.id', 'ASC'); $this->paginator = new DoctrinePaginator($this->qb); $this->paginatorAdapter = new PaginatorAdapter($this->paginator); }
while (!file_exists('config/application.config.php')) { $dir = dirname(getcwd()); if ($previousDir === $dir) { throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is DoctrineORMModule in a subdir of your application skeleton?'); } $previousDir = $dir; chdir($dir); } if (is_readable(__DIR__ . '/TestConfiguration.php')) { require_once __DIR__ . '/TestConfiguration.php'; } else { require_once __DIR__ . '/TestConfiguration.php.dist'; } set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path()); require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php'; \Zend\Loader\AutoloaderFactory::factory(); $defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate(new Zend\Module\Listener\ListenerOptions(array('module_paths' => array('./vendor')))); $moduleManager = new \Zend\Module\Manager(array('OcraComposer', 'DoctrineModule', 'DoctrineORMModule')); $moduleManager->events()->attachAggregate($defaultListeners); $moduleManager->loadModules(); $config = $defaultListeners->getConfigListener()->getMergedConfig(false); // setup sqlite $config['di']['instance']['DoctrineORMModule\\Doctrine\\ORM\\Connection']['parameters']['params'] = array('driver' => 'pdo_sqlite', 'memory' => true); // setup the driver $config['di']['instance']['orm_driver_chain']['parameters']['drivers']['doctrine_test_driver'] = array('class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver', 'namespace' => 'DoctrineORMModuleTest\\Assets\\Entity', 'paths' => array(__DIR__ . '/DoctrineORMModuleTest/Assets/Entity')); $di = new \Zend\Di\Di(); $di->instanceManager()->addTypePreference('Zend\\Di\\Locator', $di); $config = new \Zend\Di\Configuration($config['di']); $config->configure($di); \DoctrineORMModuleTest\Framework\TestCase::setLocator($di);
chdir(__DIR__); $previousDir = '.'; while (!file_exists('config/application.config.php')) { $dir = dirname(getcwd()); if ($previousDir === $dir) { throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is DoctrineORMModule in a sub-directory of your application skeleton?'); } $previousDir = $dir; chdir($dir); } if (!@(include_once __DIR__ . '/../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) { throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); } if (!($configuration = @(include __DIR__ . '/TestConfiguration.php'))) { $configuration = (require __DIR__ . '/TestConfiguration.php.dist'); } // $configuration is loaded from TestConfiguration.php (or .dist) $serviceManager = new ServiceManager(new ServiceManagerConfig(isset($configuration['service_manager']) ? $configuration['service_manager'] : array())); $serviceManager->setService('ApplicationConfig', $configuration); $serviceManager->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory'); /** @var $moduleManager \Zend\ModuleManager\ModuleManager */ $moduleManager = $serviceManager->get('ModuleManager'); $moduleManager->loadModules(); $serviceManager->setAllowOverride(true); $config = $serviceManager->get('Config'); $config['doctrine']['driver']['test'] = array('class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/DoctrineORMModuleTest/Assets/Entity')); $config['doctrine']['driver']['orm_default']['drivers']['DoctrineORMModuleTest\\Assets\\Entity'] = 'test'; $config['doctrine']['connection']['orm_default'] = array('configuration' => 'orm_default', 'eventmanager' => 'orm_default', 'driverClass' => 'Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver', 'params' => array('memory' => true)); $serviceManager->setService('Config', $config); TestCase::setServiceManager($serviceManager);
use Zend\Mvc\Service\ServiceManagerConfiguration; chdir(__DIR__); $previousDir = '.'; while (!file_exists('config/application.config.php')) { $dir = dirname(getcwd()); if ($previousDir === $dir) { throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is OcraDiCompiler in a sub-directory of your application skeleton?'); } $previousDir = $dir; chdir($dir); } if (!@(include_once __DIR__ . '/../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) { throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); } if (!($configuration = @(include __DIR__ . '/TestConfiguration.php'))) { $configuration = (require __DIR__ . '/TestConfiguration.php.dist'); } // $configuration is loaded from TestConfiguration.php (or .dist) $serviceManager = new ServiceManager(new ServiceManagerConfiguration(isset($configuration['service_manager']) ? $configuration['service_manager'] : array())); $serviceManager->setService('ApplicationConfiguration', $configuration); /** @var $moduleManager \Zend\ModuleManager\ModuleManager */ $moduleManager = $serviceManager->get('ModuleManager'); $moduleManager->loadModules(); $serviceManager->setAllowOverride(true); $config = $serviceManager->get('Configuration'); $config['doctrine']['driver']['test'] = array('class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/DoctrineORMModuleTest/Assets/Entity')); $config['doctrine']['driver']['orm_default']['drivers']['DoctrineORMModuleTest\\Assets\\Entity'] = 'test'; $config['doctrine']['connection']['orm_default'] = array('configuration' => 'orm_default', 'eventmanager' => 'orm_default', 'driverClass' => 'Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver', 'params' => array('memory' => true)); $serviceManager->setService('Configuration', $config); \DoctrineORMModuleTest\Framework\TestCase::setServiceManager($serviceManager);
/** * {@inheritDoc} */ public function setUp() { parent::setUp(); }