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); 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 */ /** @var DbObject $class fake hint for the IDE, it's a string */
$class = self::classByType($type); $class = self::classByType($type);

View File

@ -83,11 +83,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
protected function objects($type) protected function objects($type)
{ {
/** @var IcingaObject $class */ $dummy = DbObjectTypeRegistry::newObject($type);
$class = DbObjectTypeRegistry::classByType($type);
/** @var IcingaObject $dummy */
$dummy = $class::create();
$table = $dummy->getTableName(); $table = $dummy->getTableName();
$query = $this->getDb()->getDbAdapter()->select() $query = $this->getDb()->getDbAdapter()->select()
@ -97,7 +93,7 @@ class HostGroupMembershipResolverTest extends BaseTestCase
$objects = []; $objects = [];
$l = strlen(self::PREFIX); $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); $key = substr($object->getObjectName(), $l);
$objects[$key] = $object; $objects[$key] = $object;
} }