function UnicodeTest::providerTestValidateUtf8
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestValidateUtf8()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestValidateUtf8()
- 11.x core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestValidateUtf8()
Provides data for self::testValidateUtf8().
Invalid UTF-8 examples sourced from http://stackoverflow.com/a/11709412/109119.
Return value
array An array of arrays, each containing the parameters for self::testValidateUtf8().
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ UnicodeTest.php, line 269
Class
- UnicodeTest
- Test unicode handling features implemented in Unicode component.
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestValidateUtf8() {
return [
// Empty string.
[
'',
TRUE,
'An empty string did not validate.',
],
// Simple text string.
[
'Simple text.',
TRUE,
'A simple ASCII text string did not validate.',
],
// Invalid UTF-8, overlong 5 byte encoding.
[
chr(0xf8) . chr(0x80) . chr(0x80) . chr(0x80) . chr(0x80),
FALSE,
'Invalid UTF-8 was validated.',
],
// High code-point without trailing characters.
[
chr(0xd0) . chr(0x1),
FALSE,
'Invalid UTF-8 was validated.',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.