Skip to content

Commit

Permalink
BaseTestCase: Use phpunit's new TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Aug 30, 2023
1 parent c277bcf commit 044fcfd
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions library/Director/Test/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
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();
}
Expand Down
2 changes: 1 addition & 1 deletion library/Director/Test/IcingaObjectTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function prepareObjectTearDown(IcingaObject $object)
/**
* @inheritdoc
*/
public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
/** @var IcingaObject $object */
Expand Down
4 changes: 2 additions & 2 deletions library/Director/Test/SyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -49,7 +49,7 @@ public function setUp()
$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()) {
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Data/AssignFilterHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/IcingaConfig/StateFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function user2()
));
}

public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$users = array(
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Import/HostSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function removeGroups($names)
}
}

public function tearDown()
public function tearDown(): void
{
$this->removeGroups(['SYNCTEST_groupa', 'SYNCTEST_groupb']);
parent::tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
const PREFIX = '__groupmembership';
const TYPE = 'host';

public function setUp()
public function setUp(): void
{
IcingaTemplateRepository::clear();
}
Expand All @@ -32,12 +32,12 @@ public static function cleanArtifacts()
$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();
}
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Objects/IcingaCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected function loadRendered($name)
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
}

public function tearDown()
public function tearDown(): void
{
$db = $this->getDb();
if (IcingaCommand::exists($this->testCommandName, $db)) {
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Objects/IcingaHostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ protected function loadRendered($name)
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
}

public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$db = $this->getDb();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected function loadRendered($name)
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
}

public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$db = $this->getDb();
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Objects/IcingaServiceSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');

Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Objects/IcingaServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected function loadRendered($name)
return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
}

public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$db = $this->getDb();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function create($name)
return $host;
}

public function tearDown()
public function tearDown(): void
{
$db = $this->getDb();
$kill = array('t1', 't2', 't6', 't3', 't4', 't5');
Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Objects/IcingaTimePeriodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected function loadTestPeriod($suffix = '')
return IcingaTimePeriod::load($this->testPeriodName . $suffix, $this->getDb());
}

public function tearDown()
public function tearDown(): void
{
$db = $this->getDb();

Expand Down
2 changes: 1 addition & 1 deletion test/php/library/Director/Resolver/TemplateTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function removeServices(Db $db)
}
}

public function tearDown()
public function tearDown(): void
{
if ($this->hasDb()) {
$db = $this->getDb();
Expand Down

0 comments on commit 044fcfd

Please sign in to comment.