Пример #1
0
 public function setUp()
 {
     Bootstrap::initDatabase();
     $entityManager = Bootstrap::getEntityManager();
     $classMetaData = new ClassMetadata('Markov\\Entity\\User');
     $this->repository = new UserRepository($entityManager, $classMetaData);
 }
Пример #2
0
 public function setUp()
 {
     parent::setUp();
     $this->loginAdapter = new LoginAdapter(Bootstrap::getServiceManager());
     $this->request = new Request();
     $this->request->setMethod("POST");
 }
Пример #3
0
 public function setUp()
 {
     parent::setUp();
     $this->campaignService = new CampaignService(Bootstrap::getServiceManager());
     $this->request = new Request();
     $this->request->setMethod("POST");
 }
Пример #4
0
 public static function getPDO()
 {
     if (!self::$pdo) {
         self::$pdo = Bootstrap::getEntityManager()->getConnection()->getWrappedConnection();
     }
     return self::$pdo;
 }
Пример #5
0
 /**
  * @dataProvider provideServiceList
  */
 public function testService($service)
 {
     $sm = Bootstrap::getServiceManager();
     // test if service is available in SM
     $this->assertTrue($sm->has($service));
     // test if correct instance is created
     //$this->assertInstanceOf($service, $sm->get($service));
 }
Пример #6
0
 public function setUp()
 {
     parent::setUp();
     $this->customerService = new CustomerService(Bootstrap::getServiceManager());
     $this->customerService->setAccountId(self::ACCOUNT_ID);
     $this->customerService->setEntity(self::ENTITY);
     $this->request = new Request();
     $this->request->setMethod("POST");
 }
 protected function setUp()
 {
     $this->service = $this->getMockBuilder('OpsWay\\TocatBudget\\Service\\MyService')->disableOriginalConstructor()->getMock();
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new MyController($this->service);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'other'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
 }
Пример #8
0
                $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(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();
Bootstrap::chroot();
 protected function setUp()
 {
     $this->locator = Bootstrap::getServiceManager();
     $this->repository = $this->locator->get(MyRepository::class);
 }
 public function setUp()
 {
     parent::setUp();
     $this->customerSettingService = new CustomerSettingsService(Bootstrap::getServiceManager());
 }
Пример #11
0
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
error_reporting(E_ALL | E_STRICT);
chdir(dirname(__DIR__));
define('SITE_PATH', dirname(dirname(__FILE__)));
class Bootstrap
{
    protected static $serviceManager;
    public static function init()
    {
        include SITE_PATH . '/vendor/autoload.php';
        $config = (include SITE_PATH . '/config/application.config.php');
        self::loadModules($config['modules']);
        static::$serviceManager = new ServiceManager(new ServiceManagerConfig());
        static::$serviceManager->setService('ApplicationConfig', $config);
        $test = static::$serviceManager->get('ModuleManager')->loadModules();
    }
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    private static function loadModules(array $modules)
    {
        foreach ($modules as $moduleName) {
            include SITE_PATH . "/module/{$moduleName}/Module.php";
        }
    }
}
Bootstrap::init();
 public function setUp()
 {
     parent::setUp();
     $this->transactionService = new TransactionService(Bootstrap::getServiceManager());
 }