summaryrefslogtreecommitdiffstats
path: root/test/php/library/Businessprocess/BpConfigTest.php
blob: f42c58ce635889cc9c800cffbfc29a381791574f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

namespace Tests\Icinga\Module\Businessprocess;

use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Test\BaseTestCase;

class BpConfigTest extends BaseTestCase
{
    public function testJoinNodeName()
    {
        $this->assertSame(
            'foo;bar',
            BpConfig::joinNodeName('foo', 'bar')
        );
        $this->assertSame(
            'foo\;bar',
            BpConfig::joinNodeName('foo;bar')
        );
        $this->assertSame(
            'foo\;bar;baroof',
            BpConfig::joinNodeName('foo;bar', 'baroof')
        );
        $this->assertSame(
            'foo\;bar;bar;oof',
            BpConfig::joinNodeName('foo;bar', 'bar;oof')
        );
    }

    public function testSplitNodeName()
    {
        $this->assertSame(
            ['foo', 'bar'],
            BpConfig::splitNodeName('foo;bar')
        );
        $this->assertSame(
            ['foo;bar', null],
            BpConfig::splitNodeName('foo\;bar')
        );
        $this->assertSame(
            ['foo;bar', 'baroof'],
            BpConfig::splitNodeName('foo\;bar;baroof')
        );
        $this->assertSame(
            ['foo;bar', 'bar;oof'],
            BpConfig::splitNodeName('foo\;bar;bar;oof')
        );
    }
}