function PhpTransliterationTest::testPhpTransliteration
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Component\Transliteration\PhpTransliterationTest::testPhpTransliteration()
- 8.9.x core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Component\Transliteration\PhpTransliterationTest::testPhpTransliteration()
- 11.x core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Component\Transliteration\PhpTransliterationTest::testPhpTransliteration()
Tests the PhpTransliteration class.
@dataProvider providerTestPhpTransliteration
Parameters
string $langcode: The language code to test.
string $original: The original string.
string $expected: The expected return from PhpTransliteration::transliterate().
string $unknown_character: (optional) The character to substitute for characters in $string without transliterated equivalents. Defaults to '?'.
int $max_length: (optional) If provided, return at most this many characters, ensuring that the transliteration does not split in the middle of an input character's transliteration.
File
-
core/
tests/ Drupal/ Tests/ Component/ Transliteration/ PhpTransliterationTest.php, line 94
Class
- PhpTransliterationTest
- Tests Transliteration component functionality.
Namespace
Drupal\Tests\Component\TransliterationCode
public function testPhpTransliteration(string $langcode, string $original, string $expected, string $unknown_character = '?', ?int $max_length = NULL) : void {
$transliterator_class = new PhpTransliteration();
$actual = $transliterator_class->transliterate($original, $langcode, $unknown_character, $max_length);
$this->assertSame($expected, $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.