Change parent class of BaseTestCase to \Icinga\Test\BaseTestCase

This commit is contained in:
Johannes Meyer 2024-01-15 11:03:33 +01:00 committed by raviks789
parent 0ff6c8ee62
commit 58e2a8fca6
15 changed files with 26 additions and 7 deletions

View File

@ -10,20 +10,15 @@ 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 Icinga\Test\BaseTestCase as IcingaBaseTestCase;
abstract class BaseTestCase extends TestCase
abstract class BaseTestCase extends IcingaBaseTestCase
{
private static $app;
/** @var Db */
private static $db;
public function setUp(): void
{
$this->app();
}
protected function skipForMissingDb()
{
if ($this->hasDb()) {

View File

@ -88,5 +88,7 @@ abstract class IcingaObjectTestCase extends BaseTestCase
$this->subject->delete();
}
}
parent::tearDown();
}
}

View File

@ -31,6 +31,7 @@ abstract class SyncTest extends BaseTestCase
public function setUp(): void
{
parent::setUp();
$this->source = ImportSource::create(array(
'source_name' => 'testimport',
'provider_class' => 'Icinga\\Module\\Director\\Test\\ImportSourceDummy',
@ -75,6 +76,7 @@ abstract class SyncTest extends BaseTestCase
// make sure cache is clean for other tests
PrefetchCache::forget();
DbObject::clearAllPrefetchCaches();
parent::tearDown();
}
/**

View File

View File

@ -30,6 +30,7 @@ class IcingaObjectFieldFormTest extends BaseTestCase
public function setUp(): void
{
parent::setUp();
if ($this->hasDb()) {
$db = $this->getDb();
$this->testDatafield = DirectorDatafield::create([

View File

@ -167,5 +167,7 @@ class StateFilterSetTest extends BaseTestCase
}
}
}
parent::tearDown();
}
}

View File

@ -17,6 +17,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
public function setUp(): void
{
parent::setUp();
IcingaTemplateRepository::clear();
}

View File

@ -212,5 +212,7 @@ class IcingaCommandTest extends BaseTestCase
if (IcingaCommand::exists($this->testCommandName, $db)) {
IcingaCommand::load($this->testCommandName, $db)->delete();
}
parent::tearDown();
}
}

View File

@ -756,6 +756,8 @@ class IcingaHostTest extends BaseTestCase
$this->deleteDatafields();
}
parent::tearDown();
}
protected function deleteDatafields()

View File

@ -244,5 +244,7 @@ class IcingaNotificationTest extends BaseTestCase
}
}
}
parent::tearDown();
}
}

View File

@ -12,6 +12,7 @@ class IcingaServiceSetTest extends IcingaObjectTestCase
public function setUp(): void
{
parent::setUp();
$this->assertNull($this->subject, 'subject must have been taken down before!');
if ($this->hasDb()) {

View File

@ -44,6 +44,7 @@ class IcingaServiceTest extends BaseTestCase
public function testAcceptsAssignRules()
{
$this->expectNotToPerformAssertions();
$service = $this->service();
$service->object_type = 'apply';
$service->assign_filter = 'host.address="127.*"';
@ -287,5 +288,7 @@ class IcingaServiceTest extends BaseTestCase
}
}
}
parent::tearDown();
}
}

View File

@ -154,5 +154,7 @@ class IcingaTemplateResolverTest extends BaseTestCase
IcingaHost::load($name, $db)->delete();
}
}
parent::tearDown();
}
}

View File

@ -180,5 +180,7 @@ class IcingaTimePeriodTest extends BaseTestCase
IcingaTimePeriod::load($name, $db)->delete();
}
}
parent::tearDown();
}
}

View File

@ -255,5 +255,7 @@ class TemplateTreeTest extends BaseTestCase
$this->removeHosts($db);
$this->removeServices($db);
}
parent::tearDown();
}
}