public function setUp()
 {
     $this->sm = Bootstrap::getServiceManager();
     $this->sm->setAllowOverride(true);
     $servicesToMock = array('Zend\\Db\\Adapter\\Adapter' => 'Zend\\Db\\Adapter\\Adapter', 'Core\\Service\\Tick' => 'Core\\Service\\Tick', 'logger' => 'Zend\\Log\\Logger', 'Colony\\Table\\ColonyTable' => 'Colony\\Table\\ColonyTable', 'Galaxy\\Table\\SystemObjectTable' => 'Galaxy\\Table\\SystemObjectTable', 'Techtree\\Table\\ColonyBuildingTable' => 'Techtree\\Table\\ColonyBuildingTable', 'Resources\\Table\\ColonyTable' => 'Resources\\Table\\ColonyTable');
     foreach ($servicesToMock as $key => $serviceName) {
         $this->sm->setService($key, $this->getMockBuilder($serviceName)->disableOriginalConstructor()->getMock());
     }
 }
Beispiel #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();