oauth2-client/test/Bootstrap.php

46 lines
862 B
PHP
Raw Normal View History

2013-02-26 16:02:34 +04:00
<?php
2014-04-24 10:13:25 +04:00
namespace LeagueTests\OAuth2\Client;
error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
/**
* Test bootstrap, for setting up autoloading
*
* @subpackage UnitTest
*/
class Bootstrap
{
protected static $serviceManager;
public static function init()
{
static::initAutoloader();
}
protected static function initAutoloader()
{
$vendorPath = static::findParentPath('vendor');
2014-11-09 00:30:40 +03:00
$loader = include $vendorPath.'/autoload.php';
2014-04-24 10:13:25 +04:00
}
protected static function findParentPath($path)
{
$dir = __DIR__;
$previousDir = '.';
2014-11-09 00:30:40 +03:00
while (!is_dir($dir.'/'.$path)) {
2014-04-24 10:13:25 +04:00
$dir = dirname($dir);
2014-11-09 00:30:40 +03:00
if ($previousDir === $dir) {
return false;
}
2014-04-24 10:13:25 +04:00
$previousDir = $dir;
}
2014-11-09 00:30:40 +03:00
return $dir.'/'.$path;
2014-04-24 10:13:25 +04:00
}
2013-11-18 06:45:28 +04:00
}
2014-04-24 10:13:25 +04:00
Bootstrap::init();