blob: 9b4bf337aa133f226c79a146a8aabfe96edda244 (
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
|
<?php
namespace Tests\Icinga\Module\Director\IcingaConfig;
use Icinga\Module\Director\Data\RecursiveUtf8Validator;
use Icinga\Module\Director\Test\BaseTestCase;
class RecursiveUtf8ValidatorTest extends BaseTestCase
{
public function testDetectInvalidUtf8Character()
{
$this->expectException(\InvalidArgumentException::class);
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,
['💩']
]
],
],
]));
}
}
|