function PhpTransliterationTest::providerTestPhpTransliterationWithAlter

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Core\Transliteration\PhpTransliterationTest::providerTestPhpTransliterationWithAlter()
  2. 8.9.x core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Core\Transliteration\PhpTransliterationTest::providerTestPhpTransliterationWithAlter()
  3. 10 core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Core\Transliteration\PhpTransliterationTest::providerTestPhpTransliterationWithAlter()

Provides test data for testPhpTransliterationWithAlter.

Return value

array

File

core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php, line 66

Class

PhpTransliterationTest
Tests Transliteration component functionality.

Namespace

Drupal\Tests\Core\Transliteration

Code

public static function providerTestPhpTransliterationWithAlter() {
    $random_generator = new Random();
    $random = $random_generator->string(10);
    // Make some strings with two, three, and four-byte characters for testing.
    // Note that the 3-byte character is overridden by the 'kg' language.
    // cSpell:disable-next-line
    $two_byte = 'Ä Ö Ü Å Ø äöüåøhello';
    // These are two Gothic alphabet letters. See
    // http://wikipedia.org/wiki/Gothic_alphabet
    // They are not in our tables, but should at least give us '?' (unknown).
    $five_byte = html_entity_decode('𐌰𐌸', ENT_NOQUOTES, 'UTF-8');
    // Five-byte characters do not work in MySQL, so make a printable version.
    $five_byte_printable = '𐌰𐌸';
    $cases = [
        // Test the language override hook in the test module, which changes
        // the transliteration of Ä to Z and provides for the 5-byte characters.
        // cSpell:disable-next-line
[
            'zz',
            $two_byte,
            'Z O U A O aouaohello',
        ],
        [
            'zz',
            $random,
            $random,
        ],
        [
            'zz',
            $five_byte,
            'ATh',
            $five_byte_printable,
        ],
    ];
    return $cases;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.