diff --git a/test/php/library/Businessprocess/HostNodeTest.php b/test/php/library/Businessprocess/HostNodeTest.php new file mode 100644 index 0000000..bfcecf2 --- /dev/null +++ b/test/php/library/Businessprocess/HostNodeTest.php @@ -0,0 +1,48 @@ +assertEquals( + 'localhost', + $this->localhost()->getHostname() + ); + } + + public function testReturnsCorrectAlias() + { + $this->assertEquals( + 'localhost', + $this->localhost()->getAlias() + ); + } + + public function testRendersCorrectLink() + { + $this->assertEquals( + '' + . 'localhost: ping <> pong', + $this->localhost()->renderLink(new View()) + ); + } + + /** + * @return HostNode + */ + protected function localhost() + { + $bp = new BusinessProcess(); + return new HostNode($bp, (object) array( + 'hostname' => 'localhost', + 'state' => 0, + )); + } +} \ No newline at end of file diff --git a/test/php/library/Businessprocess/ServiceNodeTest.php b/test/php/library/Businessprocess/ServiceNodeTest.php new file mode 100644 index 0000000..0d3d794 --- /dev/null +++ b/test/php/library/Businessprocess/ServiceNodeTest.php @@ -0,0 +1,57 @@ +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( + '' + . 'localhost: ping <> pong', + $this->pingOnLocalhost()->renderLink(new View()) + ); + } + + /** + * @return ServiceNode + */ + protected function pingOnLocalhost() + { + $bp = new BusinessProcess(); + return new ServiceNode($bp, (object) array( + 'hostname' => 'localhost', + 'service' => 'ping <> pong', + 'state' => 0, + )); + } +} \ No newline at end of file