From 18db984057b83ca4962c89b6b79bdce6a660b58f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:42:35 +0200 Subject: Adding upstream version 2.4.0. Signed-off-by: Daniel Baumann --- .../php/library/Businessprocess/SimulationTest.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/php/library/Businessprocess/SimulationTest.php (limited to 'test/php/library/Businessprocess/SimulationTest.php') 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 @@ +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() + ); + } +} -- cgit v1.2.3