19 declare(strict_types=1);
32 $this->group =
new Group();
40 for ($i = 0; $i < 500; $i++) {
41 $length = random_int(50, 500);
43 for ($j = 0; $j < $length; $j++) {
44 $string .= chr(random_int(0, 255));
46 $strings[] = [$string, @utf8_encode($string)];
51 #[DataProvider('latin1StringProvider')] 53 string $latin_1_string,
56 $this->assertTrue(mb_check_encoding($latin_1_string,
'ISO-8859-1'));
57 $result = $this->group->latin1ToUtf8()->transform($latin_1_string);
58 $this->assertTrue(mb_check_encoding($result,
'UTF-8'));
59 $this->assertEquals($expected_utf8, $result);
66 for ($i = 0; $i < 500; $i++) {
67 $length = random_int(50, 500);
69 for ($j = 0; $j < $length; $j++) {
70 $string .= chr(random_int(0, 127));
72 $strings[] = [$string, $string];
77 #[DataProvider('asciiStringProvider')] 79 string $latin_1_string,
82 $this->assertTrue(mb_check_encoding($latin_1_string,
'US-ASCII'));
83 $result = $this->group->asciiToUtf8()->transform($latin_1_string);
84 $this->assertTrue(mb_check_encoding($result,
'UTF-8'));
85 $this->assertEquals($expected_utf8, $result);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static latin1StringProvider()
testAsciiToUTF8(string $latin_1_string, string $expected_utf8)
testLatin1ToUTF8(string $latin_1_string, string $expected_utf8)
static asciiStringProvider()