[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaHost: fix tests

git at icinga.org git at icinga.org
Tue Oct 25 04:39:59 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: ad7c5bc9974516e60857267a3c4950870d7fcb39
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=ad7c5bc9974516e60857267a3c4950870d7fcb39

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Oct 25 00:30:12 2016 +0000

IcingaHost: fix tests

---

 application/views/helpers/FormDataFilter.php         |    2 +-
 library/Director/IcingaConfig/AssignRenderer.php     |    2 +-
 library/Director/Objects/IcingaHost.php              |    3 +--
 test/php/library/Director/Objects/IcingaHostTest.php |    3 ++-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/application/views/helpers/FormDataFilter.php b/application/views/helpers/FormDataFilter.php
index 5f6e761..bae72d3 100644
--- a/application/views/helpers/FormDataFilter.php
+++ b/application/views/helpers/FormDataFilter.php
@@ -169,7 +169,7 @@ class Zend_View_Helper_FormDataFilter extends Zend_View_Helper_FormElement
                 }
             }
 
-            if ($col === 'groups' && $dummy->supportsGroups()) {
+            if (substr($col, -7) === '.groups' && $dummy->supportsGroups()) {
                 return $this->selectGroup($type, $filter);
             }
         }
diff --git a/library/Director/IcingaConfig/AssignRenderer.php b/library/Director/IcingaConfig/AssignRenderer.php
index 298f77f..4069a9d 100644
--- a/library/Director/IcingaConfig/AssignRenderer.php
+++ b/library/Director/IcingaConfig/AssignRenderer.php
@@ -56,7 +56,7 @@ class AssignRenderer
 
     protected function renderEquals($column, $expression)
     {
-        if ($column === 'groups') {
+        if (substr($column, -7) === '.groups') {
             return sprintf(
                 '%s in %s',
                 $expression,
diff --git a/library/Director/Objects/IcingaHost.php b/library/Director/Objects/IcingaHost.php
index 8b8765d..25abadd 100644
--- a/library/Director/Objects/IcingaHost.php
+++ b/library/Director/Objects/IcingaHost.php
@@ -137,10 +137,9 @@ class IcingaHost extends IcingaObject
         $properties = array();
         if (!empty($hostProperties)) {
             $properties[$props] = $hostProperties;
+            $properties[$props][$prefix . 'groups'] = 'Groups';
         }
 
-        $properties['groups'] = 'Groups';
-
         if (!empty($hostVars)) {
             $properties[$vars] = $hostVars;
         }
diff --git a/test/php/library/Director/Objects/IcingaHostTest.php b/test/php/library/Director/Objects/IcingaHostTest.php
index 08671d6..1b3175b 100644
--- a/test/php/library/Director/Objects/IcingaHostTest.php
+++ b/test/php/library/Director/Objects/IcingaHostTest.php
@@ -668,7 +668,8 @@ class IcingaHostTest extends BaseTestCase
             "${prefix}notes_url" => "notes_url",
             "${prefix}retry_interval" => "retry_interval",
             "${prefix}volatile" => "volatile",
-            "${prefix}zone" => "zone"
+            "${prefix}zone" => "zone",
+            "${prefix}groups" => "Groups"
         );
     }
     protected function loadRendered($name)



More information about the icinga-checkins mailing list