From 2afacf3431531e9ed912a79fc5c5ed2fd1f37b5c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 8 Mar 2016 21:25:27 +0100 Subject: [PATCH] BaseTestCase: newObject helper method added --- library/Director/Test/BaseTestCase.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/Director/Test/BaseTestCase.php b/library/Director/Test/BaseTestCase.php index 0eb8f453..e17a835a 100644 --- a/library/Director/Test/BaseTestCase.php +++ b/library/Director/Test/BaseTestCase.php @@ -7,6 +7,7 @@ use Icinga\Application\Config; use Icinga\Exception\ConfigurationError; use Icinga\Module\Director\Db; use Icinga\Module\Director\Db\Migrations; +use Icinga\Module\Director\Objects\IcingaObject; use PHPUnit_Framework_TestCase; class BaseTestCase extends PHPUnit_Framework_TestCase @@ -58,6 +59,16 @@ class BaseTestCase extends PHPUnit_Framework_TestCase 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() { if (self::$app === null) {