[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaServiceSetTest: add aliases the ZF way...

git at icinga.org git at icinga.org
Wed Nov 30 09:24:53 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Nov 30 08:23:54 2016 +0100

IcingaServiceSetTest: add aliases the ZF way...

...and use the correct db adapter, fixes broken tests

---

 .../Director/Objects/IcingaServiceSetTest.php      |   28 ++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/test/php/library/Director/Objects/IcingaServiceSetTest.php b/test/php/library/Director/Objects/IcingaServiceSetTest.php
index e7c58ca..2a24117 100644
--- a/test/php/library/Director/Objects/IcingaServiceSetTest.php
+++ b/test/php/library/Director/Objects/IcingaServiceSetTest.php
@@ -148,30 +148,36 @@ class IcingaServiceSetTestIcinga extends IcingaObjectTestCase
 
     public function checkForDanglingServices()
     {
-        $db = $this->getDb();
-        /** @var DbQuery $query */
+        $db = $this->getDb()->getDbAdapter();
         $query = $db->select()
-            ->from('icinga_service as s', array('id'))
-            ->joinLeft('icinga_service_set as ss', 'ss.id = s.service_set_id', array())
+            ->from(array('s' => 'icinga_service'), array('id'))
+            ->joinLeft(
+                array('ss' => 'icinga_service_set'),
+                'ss.id = s.service_set_id',
+                array()
+            )
             ->where('s.service_set_id IS NOT NULL')
             ->where('ss.id IS NULL');
 
-        $ids = $query->fetchColumn();
+        $ids = $db->fetchCol($query);
 
         $this->assertEmpty($ids, sprintf('Found dangling service_set services in database: %s', join(', ', $ids)));
     }
 
     public function checkForDanglingHostSets()
     {
-        $db = $this->getDb();
-        /** @var DbQuery $query */
+        $db = $this->getDb()->getDbAdapter();
         $query = $db->select()
-            ->from('icinga_service_set as s', array('id'))
-            ->joinLeft('icinga_host as h', 'h.id = s.host_id', array())
-            ->where('s.host_id IS NOT NULL')
+            ->from(array('ss' => 'icinga_service_set'), array('id'))
+            ->joinLeft(
+                array('h' => 'icinga_host'),
+                'h.id = ss.host_id',
+                array()
+            )
+            ->where('ss.host_id IS NOT NULL')
             ->where('h.id IS NULL');
 
-        $ids = $query->fetchColumn();
+        $ids = $db->fetchCol($query);
 
         $this->assertEmpty($ids,
             sprintf('Found dangling service_set\'s for a host, without the host in database: %s', join(', ', $ids)));



More information about the icinga-checkins mailing list