summaryrefslogtreecommitdiffstats
path: root/test/php/library/Businessprocess/ServiceNodeTest.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:42:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:42:35 +0000
commit18db984057b83ca4962c89b6b79bdce6a660b58f (patch)
tree2c9f23c086b4dfcb3e7eb2ec69210206b0782d3c /test/php/library/Businessprocess/ServiceNodeTest.php
parentInitial commit. (diff)
downloadicingaweb2-module-businessprocess-c317dc6bab668eef621846dc909e6b1af78bf49a.tar.xz
icingaweb2-module-businessprocess-c317dc6bab668eef621846dc909e6b1af78bf49a.zip
Adding upstream version 2.4.0.upstream/2.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--test/php/library/Businessprocess/ServiceNodeTest.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/php/library/Businessprocess/ServiceNodeTest.php b/test/php/library/Businessprocess/ServiceNodeTest.php
new file mode 100644
index 0000000..d56529d
--- /dev/null
+++ b/test/php/library/Businessprocess/ServiceNodeTest.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Tests\Icinga\Module\Businessprocess;
+
+use Icinga\Module\Businessprocess\BpConfig;
+use Icinga\Module\Businessprocess\ServiceNode;
+use Icinga\Module\Businessprocess\Test\BaseTestCase;
+
+class ServiceNodeTest extends BaseTestCase
+{
+ public function testReturnsCorrectHostName()
+ {
+ $this->assertEquals(
+ 'localhost',
+ $this->pingOnLocalhost()->getHostname()
+ );
+ }
+
+ public function testReturnsCorrectServiceDescription()
+ {
+ $this->assertEquals(
+ 'ping <> pong',
+ $this->pingOnLocalhost()->getServiceDescription()
+ );
+ }
+
+ public function testReturnsCorrectAlias()
+ {
+ $this->assertEquals(
+ 'localhost: ping <> pong',
+ $this->pingOnLocalhost()->getAlias()
+ );
+ }
+
+ public function testRendersCorrectLink()
+ {
+ $this->assertEquals(
+ '<a href="/icingaweb2/businessprocess/service/show?host=localhost&amp;service=ping%20%3C%3E%20pong">'
+ . 'localhost: ping &lt;&gt; pong</a>',
+ $this->pingOnLocalhost()->getLink()->render()
+ );
+ }
+
+ /**
+ * @return ServiceNode
+ */
+ protected function pingOnLocalhost()
+ {
+ $bp = new BpConfig();
+ return (new ServiceNode((object) array(
+ 'hostname' => 'localhost',
+ 'service' => 'ping <> pong',
+ 'state' => 0,
+ )))->setBpConfig($bp)->setHostAlias('localhost')->setAlias('ping <> pong');
+ }
+}