public function setUp() { $this->sm = Bootstrap::getServiceManager(); $this->em = $this->sm->get('doctrine.entitymanager.orm_default'); $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em); $classes = $this->em->getMetadataFactory()->getAllMetadata(); $tool->dropSchema($classes); $tool->createSchema($classes); parent::setUp(); }
public function setUp() { parent::setUp(); $this->sm = Bootstrap::getServiceManager(); $this->em = $this->sm->get('doctrine.entitymanager.orm_default'); $cronData1 = new Cronjob(); $cronData1->setCode('TestCode1'); $cronData1->setStatus('pending'); $cronData1->setCreateTime(new \DateTime('2013-11-4')); $cronData1->setScheduleTime(new \DateTime('2013-11-4')); $cronData2 = new Cronjob(); $cronData2->setCode('TestCode2'); $cronData2->setStatus('pending'); $cronData2->setCreateTime(new \DateTime('2013-11-5')); $cronData2->setScheduleTime(new \DateTime('2013-11-5')); $this->cronData[] = $cronData1; $this->cronData[] = $cronData2; }
public function setUp() { parent::setUp(); $this->sm = Bootstrap::getServiceManager(); }
public function testGetOptions() { $service = new \PlaygroundCore\Service\Formgen(); $service->setServiceManager(Bootstrap::getServiceManager()); $this->assertEquals(get_class($service->getOptions()), "PlaygroundCore\\Options\\ModuleOptions"); }
protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); if (is_readable($vendorPath . '/autoload.php')) { $loader = (include $vendorPath . '/autoload.php'); } else { $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false)); if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; } AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__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(); // let's avoid session_start(): Cannot send session cookie - headers already sent by ob_start();