summaryrefslogtreecommitdiffstats
path: root/test/php/library/Businessprocess/SimulationTest.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/SimulationTest.php
parentInitial commit. (diff)
downloadicingaweb2-module-businessprocess-18db984057b83ca4962c89b6b79bdce6a660b58f.tar.xz
icingaweb2-module-businessprocess-18db984057b83ca4962c89b6b79bdce6a660b58f.zip
Adding upstream version 2.4.0.upstream/2.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/php/library/Businessprocess/SimulationTest.php')
-rw-r--r--test/php/library/Businessprocess/SimulationTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/php/library/Businessprocess/SimulationTest.php b/test/php/library/Businessprocess/SimulationTest.php
new file mode 100644
index 0000000..aefeb91
--- /dev/null
+++ b/test/php/library/Businessprocess/SimulationTest.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Tests\Icinga\Module\Businessprocess;
+
+use Icinga\Module\Businessprocess\Simulation;
+use Icinga\Module\Businessprocess\Test\BaseTestCase;
+
+class SimulationTest extends BaseTestCase
+{
+ public function testSimulationInstantiation()
+ {
+ $class = 'Icinga\\Module\\Businessprocess\\Simulation';
+ $this->assertInstanceOf(
+ $class,
+ Simulation::create()
+ );
+ }
+
+ public function testAppliedSimulation()
+ {
+ $data = (object) array(
+ 'state' => 0,
+ 'acknowledged' => false,
+ 'in_downtime' => false
+ );
+ $config = $this->makeInstance()->loadProcess('simple_with-header');
+ $simulation = Simulation::create(array(
+ 'host1;Hoststatus' => $data
+ ));
+ $parent = $config->getBpNode('singleHost');
+
+ $config->applySimulation($simulation);
+ $this->assertEquals(
+ 'OK',
+ $parent->getStateName()
+ );
+
+ $parent->clearState();
+ $data->state = 1;
+ $simulation->set('host1;Hoststatus', $data);
+ $config->applySimulation($simulation);
+ $this->assertEquals(
+ 'CRITICAL',
+ $parent->getStateName()
+ );
+ }
+}