[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaHostTest: ship rendered objects, compare

git at icinga.org git at icinga.org
Thu Feb 25 21:47:58 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Feb 25 21:46:51 2016 +0100

IcingaHostTest: ship rendered objects, compare

---

 test/php/library/Director/Objects/IcingaHostTest.php |   12 ++++++++++++
 test/php/library/Director/Objects/rendered/host1.out |   12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/test/php/library/Director/Objects/IcingaHostTest.php b/test/php/library/Director/Objects/IcingaHostTest.php
index eb4a546..3a3a05e 100644
--- a/test/php/library/Director/Objects/IcingaHostTest.php
+++ b/test/php/library/Director/Objects/IcingaHostTest.php
@@ -129,6 +129,14 @@ class IcingaHostTest extends BaseTestCase
         );
     }
 
+    public function testWhetherAHostRendersCorrectly()
+    {
+        $this->assertEquals(
+            (string) $this->host(),
+            $this->loadRendered('host1')
+        );
+    }
+
     protected function host()
     {
         return IcingaHost::create(array(
@@ -151,6 +159,10 @@ class IcingaHostTest extends BaseTestCase
         ));
     }
 
+    protected function loadRendered($name)
+    {
+        return file_get_contents(__DIR__ . '/rendered/' . $name . '.out');
+    }
 
     public function tearDown()
     {
diff --git a/test/php/library/Director/Objects/rendered/host1.out b/test/php/library/Director/Objects/rendered/host1.out
new file mode 100644
index 0000000..4421655
--- /dev/null
+++ b/test/php/library/Director/Objects/rendered/host1.out
@@ -0,0 +1,12 @@
+object Host "___TEST___host" {
+    display_name = "Whatever"
+    address = "127.0.0.127"
+    vars.test1 = "string"
+    vars.test2 = 17
+    vars.test3 = false
+    vars.test4 = {
+        "this" = "is"
+        "a" = [ "dict", "ionary" ]
+    }
+}
+



More information about the icinga-checkins mailing list