public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager'); $country = $this->entityManager->find("General\\Entity\\Country", 1); $this->euData = array('country' => $country, 'since' => new \DateTime()); $this->eu = new Eu(); }
public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager'); }
$rootPath = dirname(static::findParentPath('module')); chdir($rootPath); } protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); if (file_exists($vendorPath . '/autoload.php')) { include $vendorPath . '/autoload.php'; } if (!class_exists('Zend\\Loader\\AutoloaderFactory')) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`'); } AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__]]]); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init(); Bootstrap::chroot();
} elseif (is_dir($vendorPath . '/ZF2/library')) { $zf2Path = $vendorPath . '/ZF2/library'; } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) { $zf2Path = $vendorPath . '/zendframework/zendframework/library'; } } if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } if (file_exists($vendorPath . '/autoload.php')) { include $vendorPath . '/autoload.php'; } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, 'Admin' => __DIR__ . '/../../../../module/Admin']]]); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init();