mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-04-14 21:46:22 -04:00
Add SPDX license headers and mark source files as GPL-3.0-or-later to preserve the option to relicense under later GPL versions.
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
namespace Tests\Icinga\Module\Businessprocess;
|
|
|
|
use Icinga\Module\Businessprocess\BpNode;
|
|
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
|
|
|
class BpNodeTest extends BaseTestCase
|
|
{
|
|
public function testThrowsNestingErrorWhenCheckedForLoops()
|
|
{
|
|
$this->expectException(\Icinga\Module\Businessprocess\Exception\NestingError::class);
|
|
|
|
/** @var BpNode $bpNode */
|
|
$bpNode = $this->makeLoop()->getNode('d');
|
|
$bpNode->checkForLoops();
|
|
}
|
|
|
|
public function testNestingErrorReportsFullLoop()
|
|
{
|
|
$this->expectException(\Icinga\Module\Businessprocess\Exception\NestingError::class);
|
|
$this->expectExceptionMessage('d -> a -> b -> c -> a');
|
|
|
|
/** @var BpNode $bpNode */
|
|
$bpNode = $this->makeLoop()->getNode('d');
|
|
$bpNode->checkForLoops();
|
|
}
|
|
|
|
public function testStateForALoopGivesUnknown()
|
|
{
|
|
$loop = $this->makeLoop();
|
|
/** @var BpNode $bpNode */
|
|
$bpNode = $loop->getNode('d');
|
|
$this->assertEquals(
|
|
'UNKNOWN',
|
|
$bpNode->getStateName()
|
|
);
|
|
}
|
|
}
|