From 6678a9a8f9b0daf9fa53b55e2ec2b03f7e872612 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 4 Aug 2021 15:06:34 +0200 Subject: [PATCH] HostGroupMembershipResolverTest: replace new dummy --- library/Director/Data/Db/DbObjectTypeRegistry.php | 2 +- .../Director/Objects/HostGroupMembershipResolverTest.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/library/Director/Data/Db/DbObjectTypeRegistry.php b/library/Director/Data/Db/DbObjectTypeRegistry.php index a09c32d5..a3a2e0bc 100644 --- a/library/Director/Data/Db/DbObjectTypeRegistry.php +++ b/library/Director/Data/Db/DbObjectTypeRegistry.php @@ -44,7 +44,7 @@ class DbObjectTypeRegistry return 'Icinga\\Module\\Director\\Objects\\' . $prefix . ucfirst($type); } - public static function makeObject($type, $properties = [], Db $db = null) + public static function newObject($type, $properties = [], Db $db = null) { /** @var DbObject $class fake hint for the IDE, it's a string */ $class = self::classByType($type); diff --git a/test/php/library/Director/Objects/HostGroupMembershipResolverTest.php b/test/php/library/Director/Objects/HostGroupMembershipResolverTest.php index ffe1ff57..cf2fb368 100644 --- a/test/php/library/Director/Objects/HostGroupMembershipResolverTest.php +++ b/test/php/library/Director/Objects/HostGroupMembershipResolverTest.php @@ -83,11 +83,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase protected function objects($type) { - /** @var IcingaObject $class */ - $class = DbObjectTypeRegistry::classByType($type); - - /** @var IcingaObject $dummy */ - $dummy = $class::create(); + $dummy = DbObjectTypeRegistry::newObject($type); $table = $dummy->getTableName(); $query = $this->getDb()->getDbAdapter()->select() @@ -97,7 +93,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase $objects = []; $l = strlen(self::PREFIX); - foreach ($class::loadAll($this->getDb(), $query) as $object) { + foreach ($dummy::loadAll($this->getDb(), $query) as $object) { $key = substr($object->getObjectName(), $l); $objects[$key] = $object; }