示例#1
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $this->formService = new FormService();
     $this->formService->setServiceLocator($this->serviceManager);
 }
示例#2
0
    {
        $vendorPath = static::findParentPath('vendor');
        $zf2Path = getenv('ZF2_PATH');
        if (!$zf2Path) {
            if (defined('ZF2_PATH')) {
                $zf2Path = ZF2_PATH;
            } 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__, 'Zend' => __DIR__ . '/' . __NAMESPACE__]]]);
    }
    /**
     * @return ServiceManager
     */
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
}
Bootstrap::init();
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $this->ambassadorService = $this->serviceManager->get(AmbassadorService::class);
 }