BaseTestCase: add simple test bootstrapping

This commit is contained in:
Thomas Gelf 2016-02-25 18:23:05 +01:00
parent 40d505a7fe
commit 9cd5f46a68
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
<?php
namespace Icinga\Module\Director\Test;
use Icinga\Application\Cli;
use PHPUnit_Framework_TestCase;
class BaseTestCase extends PHPUnit_Framework_TestCase
{
private $app;
public function setUp()
{
$this->app();
}
protected function app()
{
if ($this->app === null) {
$testModuleDir = $_SERVER['PWD'];
$libDir = dirname(dirname($testModuleDir)) . '/library';
require_once $libDir . '/Icinga/Application/Cli.php';
$this->app = Cli::start();
}
return $this->app;
}
}