Blame view
sources/3rdparty/sabre/vobject/tests/Sabre/VObject/StringUtilTest.php
1022 Bytes
|
6d9380f96
|
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<?php
namespace Sabre\VObject;
class StringUtilTest extends \PHPUnit_Framework_TestCase {
function testNonUTF8() {
$string = StringUtil::isUTF8(chr('0xbf'));
$this->assertEquals(false, $string);
}
function testIsUTF8() {
$string = StringUtil::isUTF8('I ๐ SabreDAV');
$this->assertEquals(true, $string);
}
function testUTF8ControlChar() {
$string = StringUtil::isUTF8(chr('0x00'));
$this->assertEquals(false, $string);
}
function testConvertToUTF8nonUTF8() {
$string = StringUtil::convertToUTF8(chr('0xbf'));
$this->assertEquals(utf8_encode(chr('0xbf')), $string);
}
function testConvertToUTF8IsUTF8() {
$string = StringUtil::convertToUTF8('I ๐ SabreDAV');
$this->assertEquals('I ๐ SabreDAV', $string);
}
function testConvertToUTF8ControlChar() {
$string = StringUtil::convertToUTF8(chr(0x00));
$this->assertEquals('', $string);
}
}
|