HostGroupMembershipResolverTest: replace new dummy
This commit is contained in:
parent
66de47b10b
commit
6678a9a8f9
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue