diff --git a/library/Director/Test/BaseTestCase.php b/library/Director/Test/BaseTestCase.php index adc24cb6..f0cf8e55 100644 --- a/library/Director/Test/BaseTestCase.php +++ b/library/Director/Test/BaseTestCase.php @@ -76,11 +76,14 @@ abstract class BaseTestCase extends IcingaBaseTestCase 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; diff --git a/test/php/library/Director/Objects/IcingaHostTest.php b/test/php/library/Director/Objects/IcingaHostTest.php index 52ec23e6..f8ec222d 100644 --- a/test/php/library/Director/Objects/IcingaHostTest.php +++ b/test/php/library/Director/Objects/IcingaHostTest.php @@ -747,7 +747,7 @@ class IcingaHostTest extends BaseTestCase } } - $kill = array('___TEST___zone'); + $kill = ['___TEST___zone', '___TEST___zone2']; foreach ($kill as $name) { if (IcingaZone::exists($name, $db)) { IcingaZone::load($name, $db)->delete();