Esempio n. 1
0
 public function setUp()
 {
     $this->initDatabaseAdapter();
     $this->sm = Bootstrap::getServiceManager();
     $this->sm->setAllowOverride(true);
     $this->sm->setService('Zend\\Db\\Adapter\\Adapter', $this->dbAdapter);
     $tables = array();
     $tables['resource'] = $this->sm->get('Resources\\Table\\ResourceTable');
     $tables['colonyresources'] = $this->sm->get('Resources\\Table\\ColonyTable');
     $tables['userresources'] = $this->sm->get('Resources\\Table\\UserTable');
     $tick = new Tick(16000);
     $services = array();
     $galaxyService = $this->getMockBuilder('Colony\\Service\\ColonyService')->disableOriginalConstructor()->getMock();
     $galaxyService->expects($this->any())->method('checkColonyOwner')->will($this->returnValueMap(array(array(1, 99, false), array(1, 3, true))));
     $colonyEntity = new \Colony\Entity\Colony();
     $colonyEntity->setId(1);
     $colonyEntity->setUserId(3);
     $galaxyService->expects($this->any())->method('getColony')->will($this->returnValueMap(array(array(1, $colonyEntity))));
     $services['galaxy'] = $galaxyService;
     $this->_service = new ResourcesService($tick, $tables, $services);
     $logger = $this->getMockBuilder('Zend\\Log\\Logger')->disableOriginalConstructor()->getMock();
     $this->_service->setLogger($logger);
     $this->_entityId = 52;
     $this->_colonyId = 1;
 }
Esempio n. 2
0
            } 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.');
        }
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    /**
     * @param string $path
     */
    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();