Exemplo n.º 1
0
    }
    public static function chroot()
    {
        $rootPath = dirname(realpath('../'));
        chdir($rootPath);
    }
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    protected static function initAutoloader()
    {
        include_once self::findParentPath('vendor') . '/autoload.php';
    }
    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();
Exemplo n.º 2
0
 public function testShouldCreateInstance()
 {
     $collector = Bootstrap::getServiceManager()->get('Skpd\\ProfilerToolbar\\ProfilerCollector');
     $this->assertInstanceOf('Skpd\\ProfilerToolbar\\Collector\\XhprofCollector', $collector);
 }