HostGroupMembershipResolverTest: replace new dummy

This commit is contained in:
Thomas Gelf 2021-08-04 15:06:34 +02:00
parent 66de47b10b
commit 6678a9a8f9
2 changed files with 3 additions and 7 deletions

View File

@ -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);

View File

@ -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;
}