summaryrefslogtreecommitdiffstats
path: root/test/php/library/Businessprocess/MetadataTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'test/php/library/Businessprocess/MetadataTest.php')
-rw-r--r--test/php/library/Businessprocess/MetadataTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/php/library/Businessprocess/MetadataTest.php b/test/php/library/Businessprocess/MetadataTest.php
new file mode 100644
index 0000000..765caf8
--- /dev/null
+++ b/test/php/library/Businessprocess/MetadataTest.php
@@ -0,0 +1,32 @@
+<?php
+
+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'))
+ );
+ }
+}