diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
commit | f66ab8dae2f3d0418759f81a3a64dc9517a62449 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /test/php/library/Director/Data/RecursiveUtf8ValidatorTest.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.tar.xz icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.zip |
Adding upstream version 1.10.2.upstream/1.10.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/php/library/Director/Data/RecursiveUtf8ValidatorTest.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/php/library/Director/Data/RecursiveUtf8ValidatorTest.php b/test/php/library/Director/Data/RecursiveUtf8ValidatorTest.php new file mode 100644 index 0000000..1434d4a --- /dev/null +++ b/test/php/library/Director/Data/RecursiveUtf8ValidatorTest.php @@ -0,0 +1,45 @@ +<?php + +namespace Tests\Icinga\Module\Director\IcingaConfig; + +use Icinga\Module\Director\Data\RecursiveUtf8Validator; +use Icinga\Module\Director\Test\BaseTestCase; + +class RecursiveUtf8ValidatorTest extends BaseTestCase +{ + /** + * @expectedException \InvalidArgumentException + */ + public function testDetectInvalidUtf8Character() + { + RecursiveUtf8Validator::validateRows([ + (object) [ + 'name' => 'test 1', + 'value' => 'something', + ], + (object) [ + 'name' => 'test 2', + 'value' => "some\xa1\xa2thing", + ], + ]); + } + + public function testAcceptValidUtf8Characters() + { + $this->assertTrue(RecursiveUtf8Validator::validateRows([ + (object) [ + 'name' => 'test 1', + 'value' => "Some 🍻", + ], + (object) [ + 'name' => 'test 2', + 'value' => [ + (object) [ + 'its' => true, + ['💩'] + ] + ], + ], + ])); + } +} |