test/bootstrap: allow fallback to configdir

This commit is contained in:
Thomas Gelf 2016-11-03 03:06:06 +01:00
parent c57b943544
commit 7e2f8c9430
1 changed files with 14 additions and 2 deletions

View File

@ -3,13 +3,25 @@
use Icinga\Application\Cli; use Icinga\Application\Cli;
call_user_func(function() { call_user_func(function() {
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL | E_STRICT);
$testbase = __DIR__; $testbase = __DIR__;
$base = dirname($testbase); $base = dirname($testbase);
require_once 'Icinga/Application/Cli.php'; require_once 'Icinga/Application/Cli.php';
require_once $base . '/library/Director/Test/BaseTestCase.php'; require_once $base . '/library/Director/Test/BaseTestCase.php';
symlink($base, $testbase . '/modules/director');
Cli::start($testbase, $testbase . '/config') if (! file_exists($testbase . '/modules/director')) {
symlink($base, $testbase . '/modules/director');
}
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
} else {
$configDir = $testbase . '/config';
}
Cli::start($testbase, $configDir)
->getModuleManager() ->getModuleManager()
->loadModule('director'); ->loadModule('director');
}); });