icingaweb2-module-director/library/Director/Test/BaseTestCase.php

29 lines
589 B
PHP
Raw Normal View History

<?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;
public function setUp()
{
$this->app();
}
protected function app()
{
2016-02-25 18:31:00 +01:00
if (self::$app === null) {
$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:31:00 +01:00
return self::$app;
}
}