Skip to content

Commit

Permalink
BaseTestCase: Change parent class to \Icinga\Test\BaseTestCase and …
Browse files Browse the repository at this point in the history
…fix-multiple-test-runs
  • Loading branch information
nilmerg authored and raviks789 committed Jan 15, 2024
1 parent 42cc6fd commit f97512f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions library/Director/Test/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
use Icinga\Module\Director\Objects\IcingaZone;
use PHPUnit\Framework\TestCase;

abstract class BaseTestCase extends TestCase
abstract class BaseTestCase extends \Icinga\Test\BaseTestCase
{
private static $app;

/** @var Db */
private static $db;

public function setUp(): void
public function ssetUp(): void
{
$this->app();
}
Expand Down Expand Up @@ -81,11 +81,14 @@ protected static function getDb()
self::$db = new Db($dbConfig);
$migrations = new Migrations(self::$db);
$migrations->applyPendingMigrations();
IcingaZone::create([
$zone = IcingaZone::create([
'object_name' => 'director-global',
'object_type' => 'external_object',
'is_global' => 'y'
])->store(self::$db);
]);
if (! IcingaZone::exists($zone->getId(), self::$db)) {
$zone->store(self::$db);
}
}

return self::$db;
Expand Down
Empty file removed test/config/config.ini
Empty file.
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 @@ -747,7 +747,7 @@ public function tearDown(): void
}
}

$kill = array('___TEST___zone');
$kill = ['___TEST___zone', '___TEST___zone2'];
foreach ($kill as $name) {
if (IcingaZone::exists($name, $db)) {
IcingaZone::load($name, $db)->delete();
Expand Down
1 change: 1 addition & 0 deletions test/php/library/Director/Objects/IcingaServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testFailsToStoreWithMissingLazyRelations()

public function testAcceptsAssignRules()
{
$this->expectNotToPerformAssertions();
$service = $this->service();
$service->object_type = 'apply';
$service->assign_filter = 'host.address="127.*"';
Expand Down

0 comments on commit f97512f

Please sign in to comment.