コード例 #1
0
ファイル: Bootstrap.php プロジェクト: skpd/profiler-toolbar
    }
    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();
コード例 #2
0
 public function testShouldCreateInstance()
 {
     $collector = Bootstrap::getServiceManager()->get('Skpd\\ProfilerToolbar\\ProfilerCollector');
     $this->assertInstanceOf('Skpd\\ProfilerToolbar\\Collector\\XhprofCollector', $collector);
 }