Пример #1
0
 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();
 }
Пример #2
0
 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();
 }
Пример #4
0
 public function testGetOptions()
 {
     $service = new \PlaygroundCore\Service\Formgen();
     $service->setServiceManager(Bootstrap::getServiceManager());
     $this->assertEquals(get_class($service->getOptions()), "PlaygroundCore\\Options\\ModuleOptions");
 }
Пример #5
0
    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();