2016-02-25 18:23:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Test;
|
|
|
|
|
|
|
|
use Icinga\Application\Cli;
|
|
|
|
use PHPUnit_Framework_TestCase;
|
|
|
|
|
|
|
|
class BaseTestCase extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
2016-02-25 18:31:00 +01:00
|
|
|
private static $app;
|
2016-02-25 18:23:05 +01:00
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->app();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function app()
|
|
|
|
{
|
2016-02-25 18:31:00 +01:00
|
|
|
if (self::$app === null) {
|
2016-02-25 18:23:05 +01:00
|
|
|
$testModuleDir = $_SERVER['PWD'];
|
|
|
|
$libDir = dirname(dirname($testModuleDir)) . '/library';
|
|
|
|
require_once $libDir . '/Icinga/Application/Cli.php';
|
2016-02-25 18:31:00 +01:00
|
|
|
self::$app = Cli::start();
|
2016-02-25 18:23:05 +01:00
|
|
|
}
|
|
|
|
|
2016-02-25 18:31:00 +01:00
|
|
|
return self::$app;
|
2016-02-25 18:23:05 +01:00
|
|
|
}
|
|
|
|
}
|