public function UnicodeTest::providerTestValidateUtf8 in Drupal 9
Same name and namespace in other branches
- 8 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 337
Class
- UnicodeTest
- Test unicode handling features implemented in Unicode component.
Namespace
Drupal\Tests\Component\UtilityCode
public 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.',
],
];
}