mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
BaseTestCase: Use phpunit's new TestCase
This commit is contained in:
parent
37c8056689
commit
629297116b
@ -10,16 +10,16 @@ use Icinga\Module\Director\Db;
|
|||||||
use Icinga\Module\Director\Db\Migrations;
|
use Icinga\Module\Director\Db\Migrations;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Objects\IcingaZone;
|
use Icinga\Module\Director\Objects\IcingaZone;
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
abstract class BaseTestCase extends PHPUnit_Framework_TestCase
|
abstract class BaseTestCase extends TestCase
|
||||||
{
|
{
|
||||||
private static $app;
|
private static $app;
|
||||||
|
|
||||||
/** @var Db */
|
/** @var Db */
|
||||||
private static $db;
|
private static $db;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->app();
|
$this->app();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ abstract class IcingaObjectTestCase extends BaseTestCase
|
|||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
/** @var IcingaObject $object */
|
/** @var IcingaObject $object */
|
||||||
|
@ -29,7 +29,7 @@ abstract class SyncTest extends BaseTestCase
|
|||||||
/** @var Sync */
|
/** @var Sync */
|
||||||
protected $sync;
|
protected $sync;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->source = ImportSource::create(array(
|
$this->source = ImportSource::create(array(
|
||||||
'source_name' => 'testimport',
|
'source_name' => 'testimport',
|
||||||
@ -49,7 +49,7 @@ abstract class SyncTest extends BaseTestCase
|
|||||||
$this->sync = new Sync($this->rule);
|
$this->sync = new Sync($this->rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
// properties should be deleted automatically
|
// properties should be deleted automatically
|
||||||
if ($this->rule !== null && $this->rule->hasBeenLoadedFromDb()) {
|
if ($this->rule !== null && $this->rule->hasBeenLoadedFromDb()) {
|
||||||
|
@ -11,7 +11,7 @@ class AssignFilterHelperTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
protected static $exampleHost;
|
protected static $exampleHost;
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
self::$exampleHost = (object) [
|
self::$exampleHost = (object) [
|
||||||
'address' => '127.0.0.1',
|
'address' => '127.0.0.1',
|
||||||
|
@ -152,7 +152,7 @@ class StateFilterSetTest extends BaseTestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
$users = array(
|
$users = array(
|
||||||
|
@ -242,7 +242,7 @@ class HostSyncTest extends SyncTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->removeGroups(['SYNCTEST_groupa', 'SYNCTEST_groupb']);
|
$this->removeGroups(['SYNCTEST_groupa', 'SYNCTEST_groupb']);
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
@ -15,7 +15,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
|
|||||||
const PREFIX = '__groupmembership';
|
const PREFIX = '__groupmembership';
|
||||||
const TYPE = 'host';
|
const TYPE = 'host';
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
IcingaTemplateRepository::clear();
|
IcingaTemplateRepository::clear();
|
||||||
}
|
}
|
||||||
@ -32,12 +32,12 @@ class HostGroupMembershipResolverTest extends BaseTestCase
|
|||||||
$db->delete('icinga_' . self::TYPE, $where);
|
$db->delete('icinga_' . self::TYPE, $where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
static::cleanArtifacts();
|
static::cleanArtifacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass(): void
|
||||||
{
|
{
|
||||||
static::cleanArtifacts();
|
static::cleanArtifacts();
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ class IcingaCommandTest extends BaseTestCase
|
|||||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
if (IcingaCommand::exists($this->testCommandName, $db)) {
|
if (IcingaCommand::exists($this->testCommandName, $db)) {
|
||||||
|
@ -731,7 +731,7 @@ class IcingaHostTest extends BaseTestCase
|
|||||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
@ -226,7 +226,7 @@ class IcingaNotificationTest extends BaseTestCase
|
|||||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
@ -10,7 +10,7 @@ class IcingaServiceSetTest extends IcingaObjectTestCase
|
|||||||
protected $table = 'icinga_service_set';
|
protected $table = 'icinga_service_set';
|
||||||
protected $testObjectName = '___TEST___set';
|
protected $testObjectName = '___TEST___set';
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->assertNull($this->subject, 'subject must have been taken down before!');
|
$this->assertNull($this->subject, 'subject must have been taken down before!');
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ class IcingaServiceTest extends BaseTestCase
|
|||||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
@ -144,7 +144,7 @@ class IcingaTemplateResolverTest extends BaseTestCase
|
|||||||
return $host;
|
return $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
$kill = array('t1', 't2', 't6', 't3', 't4', 't5');
|
$kill = array('t1', 't2', 't6', 't3', 't4', 't5');
|
||||||
|
@ -171,7 +171,7 @@ class IcingaTimePeriodTest extends BaseTestCase
|
|||||||
return IcingaTimePeriod::load($this->testPeriodName . $suffix, $this->getDb());
|
return IcingaTimePeriod::load($this->testPeriodName . $suffix, $this->getDb());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ class TemplateTreeTest extends BaseTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown(): void
|
||||||
{
|
{
|
||||||
if ($this->hasDb()) {
|
if ($this->hasDb()) {
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user