Add composer support for testing
This commit is contained in:
parent
dfb97268ee
commit
10ee7901c8
|
@ -1 +1,7 @@
|
|||
.*
|
||||
## Editors
|
||||
/.idea/
|
||||
.*.sw[op]
|
||||
|
||||
## PHP / composer
|
||||
/vendor/
|
||||
composer.lock
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "icingaweb2-director",
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">= 5",
|
||||
"icinga/icingaweb2": ">= 2.3",
|
||||
"squizlabs/php_codesniffer": ">= 2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Icinga\\Module\\Director\\": "library/Director/"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "icinga/icingaweb2",
|
||||
"version": "2.3.4",
|
||||
"dist": {
|
||||
"url": "https://github.com/Icinga/icingaweb2/archive/v2.3.4.zip",
|
||||
"type": "zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -6,6 +6,7 @@ use Icinga\Application\Icinga;
|
|||
use Icinga\Application\Config;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Module\Director\Data\Db\DbConnection;
|
||||
use Icinga\Module\Director\Db;
|
||||
use Icinga\Module\Director\Db\Migrations;
|
||||
use Icinga\Module\Director\Objects\IcingaObject;
|
||||
|
@ -47,6 +48,10 @@ class BaseTestCase extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DbConnection
|
||||
* @throws ConfigurationError
|
||||
*/
|
||||
protected function getDb()
|
||||
{
|
||||
if ($this->db === null) {
|
||||
|
|
|
@ -2,6 +2,22 @@
|
|||
|
||||
use Icinga\Application\Cli;
|
||||
|
||||
## Load Composer environment, if existing
|
||||
call_user_func(function() {
|
||||
$MODULE_HOME = dirname(dirname(__FILE__));
|
||||
$composer_load = $MODULE_HOME . '/vendor/autoload.php';
|
||||
if (file_exists($composer_load)) {
|
||||
require_once $composer_load;
|
||||
|
||||
# include Icinga Web
|
||||
ini_set('include_path',
|
||||
$MODULE_HOME . '/vendor/icinga/icingaweb2/library'
|
||||
. PATH_SEPARATOR . $MODULE_HOME . '/vendor/icinga/icingaweb2/library/vendor'
|
||||
. PATH_SEPARATOR . ini_get('include_path')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
call_user_func(function() {
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
|
Loading…
Reference in New Issue