2017-02-08 10:05:06 -05:00
|
|
|
<?php
|
|
|
|
|
|
2026-02-23 16:57:03 -05:00
|
|
|
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2017-02-08 10:05:06 -05:00
|
|
|
namespace Tests\Icinga\Module\Businessprocess;
|
|
|
|
|
|
|
|
|
|
use Icinga\Module\Businessprocess\Metadata;
|
|
|
|
|
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
|
|
|
|
|
|
|
|
|
class MetadataTest extends BaseTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testDetectsMatchingPrefixes()
|
|
|
|
|
{
|
|
|
|
|
$meta = new Metadata('matchme');
|
|
|
|
|
$this->assertFalse(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array())
|
|
|
|
|
);
|
|
|
|
|
$this->assertFalse(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array('matchr', 'atchme'))
|
|
|
|
|
);
|
|
|
|
|
$this->assertTrue(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array('not', 'mat', 'yes'))
|
|
|
|
|
);
|
|
|
|
|
$this->assertTrue(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array('m'))
|
|
|
|
|
);
|
|
|
|
|
$this->assertTrue(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array('matchme'))
|
|
|
|
|
);
|
|
|
|
|
$this->assertFalse(
|
|
|
|
|
$meta->nameIsPrefixedWithOneOf(array('matchmenot'))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|