62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?php
|
|
|
|
$applicationPath = realpath(dirname(__FILE__) . '/../../application/');
|
|
$modulePath = realpath(dirname(__FILE__) . '/../../modules/');
|
|
$libraryPath = realpath(dirname(__FILE__) . '/../../library/');
|
|
$testLibraryPath = realpath(dirname(__FILE__) . '/library/');
|
|
$configPath = realpath($libraryPath . '/../config');
|
|
|
|
// Is usually done in the application's bootstrap and is used by some of our internals
|
|
if (!defined('ICINGA_APPDIR')) {
|
|
define('ICINGA_APPDIR', $applicationPath);
|
|
}
|
|
if (!defined('ICINGA_LIBDIR')) {
|
|
define('ICINGA_LIBDIR', $libraryPath);
|
|
}
|
|
|
|
// This is needed to get the Zend Plugin loader working
|
|
set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path())));
|
|
|
|
require_once 'Mockery/Loader.php';
|
|
require_once 'Hamcrest/Hamcrest.php';
|
|
$mockeryLoader = new \Mockery\Loader;
|
|
$mockeryLoader->register();
|
|
|
|
require_once($libraryPath . '/Icinga/Application/Loader.php');
|
|
|
|
$loader = new Icinga\Application\Loader();
|
|
$loader->registerNamespace('Tests', $testLibraryPath);
|
|
$loader->registerNamespace('Icinga', $libraryPath . '/Icinga');
|
|
$loader->registerNamespace('Icinga\\Form', $applicationPath . '/forms');
|
|
|
|
$modules = scandir($modulePath);
|
|
foreach ($modules as $module) {
|
|
if ($module === '.' || $module === '..') {
|
|
continue;
|
|
}
|
|
|
|
$moduleNamespace = 'Icinga\\Module\\' . ucfirst($module);
|
|
$moduleLibraryPath = $modulePath . '/' . $module . '/library/' . ucfirst($module);
|
|
|
|
if (is_dir($moduleLibraryPath)) {
|
|
$loader->registerNamespace($moduleNamespace, $moduleLibraryPath);
|
|
}
|
|
|
|
$moduleTestPath = $modulePath . '/' . $module . '/test/php';
|
|
if (is_dir($moduleTestPath)) {
|
|
$loader->registerNamespace('Tests\\' . $moduleNamespace, $moduleTestPath);
|
|
}
|
|
|
|
$moduleFormPath = $modulePath . '/' . $module . '/application/forms';
|
|
if (is_dir($moduleFormPath)) {
|
|
$loader->registerNamespace($moduleNamespace . '\\Form', $moduleFormPath);
|
|
}
|
|
}
|
|
|
|
$loader->register();
|
|
|
|
require_once 'Zend/Loader/Autoloader.php';
|
|
\Zend_Loader_Autoloader::getInstance();
|
|
|
|
Icinga\Application\Config::$configDir = $configPath;
|