mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-23 13:54:27 +02:00
BaseTestCase: newObject helper method added
This commit is contained in:
parent
bbd96fd375
commit
2afacf3431
@ -7,6 +7,7 @@ use Icinga\Application\Config;
|
|||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Db\Migrations;
|
use Icinga\Module\Director\Db\Migrations;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
class BaseTestCase extends PHPUnit_Framework_TestCase
|
class BaseTestCase extends PHPUnit_Framework_TestCase
|
||||||
@ -58,6 +59,16 @@ class BaseTestCase extends PHPUnit_Framework_TestCase
|
|||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function newObject($type, $name, $properties = array())
|
||||||
|
{
|
||||||
|
if (! array_key_exists('object_type', $properties)) {
|
||||||
|
$properties['object_type'] = 'object';
|
||||||
|
}
|
||||||
|
$properties['object_name'] = $name;
|
||||||
|
|
||||||
|
return IcingaObject::createByType($type, $properties);
|
||||||
|
}
|
||||||
|
|
||||||
protected function app()
|
protected function app()
|
||||||
{
|
{
|
||||||
if (self::$app === null) {
|
if (self::$app === null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user