Mercurial > hg > rc1
comparison vendor/sabre/vobject/tests/VObject/StringUtilTest.php @ 7:430dbd5346f7
vendor sabre as distributed
author | Charlie Root |
---|---|
date | Sat, 13 Jan 2018 09:06:10 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:cec75ba50afc | 7:430dbd5346f7 |
---|---|
1 <?php | |
2 | |
3 namespace Sabre\VObject; | |
4 | |
5 class StringUtilTest extends \PHPUnit_Framework_TestCase { | |
6 | |
7 function testNonUTF8() { | |
8 | |
9 $string = StringUtil::isUTF8(chr(0xbf)); | |
10 | |
11 $this->assertEquals(false, $string); | |
12 | |
13 } | |
14 | |
15 function testIsUTF8() { | |
16 | |
17 $string = StringUtil::isUTF8('I 💚 SabreDAV'); | |
18 | |
19 $this->assertEquals(true, $string); | |
20 | |
21 } | |
22 | |
23 function testUTF8ControlChar() { | |
24 | |
25 $string = StringUtil::isUTF8(chr(0x00)); | |
26 | |
27 $this->assertEquals(false, $string); | |
28 | |
29 } | |
30 | |
31 function testConvertToUTF8nonUTF8() { | |
32 | |
33 $string = StringUtil::convertToUTF8(chr(0xbf)); | |
34 | |
35 $this->assertEquals(utf8_encode(chr(0xbf)), $string); | |
36 | |
37 } | |
38 | |
39 function testConvertToUTF8IsUTF8() { | |
40 | |
41 $string = StringUtil::convertToUTF8('I 💚 SabreDAV'); | |
42 | |
43 $this->assertEquals('I 💚 SabreDAV', $string); | |
44 | |
45 } | |
46 | |
47 function testConvertToUTF8ControlChar() { | |
48 | |
49 $string = StringUtil::convertToUTF8(chr(0x00)); | |
50 | |
51 $this->assertEquals('', $string); | |
52 | |
53 } | |
54 | |
55 } |