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\Objects\IcingaObject;
|
||||
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;
|
||||
|
||||
/** @var Db */
|
||||
private static $db;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->app();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ abstract class IcingaObjectTestCase extends BaseTestCase
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
/** @var IcingaObject $object */
|
||||
|
@ -29,7 +29,7 @@ abstract class SyncTest extends BaseTestCase
|
||||
/** @var Sync */
|
||||
protected $sync;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->source = ImportSource::create(array(
|
||||
'source_name' => 'testimport',
|
||||
@ -49,7 +49,7 @@ abstract class SyncTest extends BaseTestCase
|
||||
$this->sync = new Sync($this->rule);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
// properties should be deleted automatically
|
||||
if ($this->rule !== null && $this->rule->hasBeenLoadedFromDb()) {
|
||||
|
@ -11,7 +11,7 @@ class AssignFilterHelperTest extends BaseTestCase
|
||||
{
|
||||
protected static $exampleHost;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$exampleHost = (object) [
|
||||
'address' => '127.0.0.1',
|
||||
|
@ -152,7 +152,7 @@ class StateFilterSetTest extends BaseTestCase
|
||||
));
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
$users = array(
|
||||
|
@ -242,7 +242,7 @@ class HostSyncTest extends SyncTest
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
$this->removeGroups(['SYNCTEST_groupa', 'SYNCTEST_groupb']);
|
||||
parent::tearDown();
|
||||
|
@ -15,7 +15,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
|
||||
const PREFIX = '__groupmembership';
|
||||
const TYPE = 'host';
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
IcingaTemplateRepository::clear();
|
||||
}
|
||||
@ -32,12 +32,12 @@ class HostGroupMembershipResolverTest extends BaseTestCase
|
||||
$db->delete('icinga_' . self::TYPE, $where);
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
static::cleanArtifacts();
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
static::cleanArtifacts();
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ class IcingaCommandTest extends BaseTestCase
|
||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
$db = $this->getDb();
|
||||
if (IcingaCommand::exists($this->testCommandName, $db)) {
|
||||
|
@ -731,7 +731,7 @@ class IcingaHostTest extends BaseTestCase
|
||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
$db = $this->getDb();
|
||||
|
@ -226,7 +226,7 @@ class IcingaNotificationTest extends BaseTestCase
|
||||
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
$db = $this->getDb();
|
||||
|
@ -10,7 +10,7 @@ class IcingaServiceSetTest extends IcingaObjectTestCase
|
||||
protected $table = 'icinga_service_set';
|
||||
protected $testObjectName = '___TEST___set';
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$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');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
$db = $this->getDb();
|
||||
|
@ -144,7 +144,7 @@ class IcingaTemplateResolverTest extends BaseTestCase
|
||||
return $host;
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
$db = $this->getDb();
|
||||
$kill = array('t1', 't2', 't6', 't3', 't4', 't5');
|
||||
|
@ -171,7 +171,7 @@ class IcingaTimePeriodTest extends BaseTestCase
|
||||
return IcingaTimePeriod::load($this->testPeriodName . $suffix, $this->getDb());
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
$db = $this->getDb();
|
||||
|
||||
|
@ -248,7 +248,7 @@ class TemplateTreeTest extends BaseTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
if ($this->hasDb()) {
|
||||
$db = $this->getDb();
|
||||
|
Loading…
x
Reference in New Issue
Block a user