BaseTestCase: Use phpunit's new TestCase

This commit is contained in:
Johannes Meyer 2023-08-30 14:37:31 +02:00
parent 37c8056689
commit 629297116b
15 changed files with 20 additions and 20 deletions

View File

@ -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();
}

View File

@ -76,7 +76,7 @@ abstract class IcingaObjectTestCase extends BaseTestCase
/**
* @inheritdoc
*/
public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
/** @var IcingaObject $object */

View File

@ -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()) {

View File

@ -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',

View File

@ -152,7 +152,7 @@ class StateFilterSetTest extends BaseTestCase
));
}
public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$users = array(

View File

@ -242,7 +242,7 @@ class HostSyncTest extends SyncTest
}
}
public function tearDown()
public function tearDown(): void
{
$this->removeGroups(['SYNCTEST_groupa', 'SYNCTEST_groupb']);
parent::tearDown();

View File

@ -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();
}

View File

@ -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)) {

View File

@ -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();

View File

@ -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();

View File

@ -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!');

View File

@ -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();

View File

@ -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');

View File

@ -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();

View File

@ -248,7 +248,7 @@ class TemplateTreeTest extends BaseTestCase
}
}
public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$db = $this->getDb();