function PhpTransliterationTest::testPhpTransliteration
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php \Drupal\Tests\Component\Transliteration\PhpTransliterationTest::testPhpTransliteration()
- 10 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 92
Class
- PhpTransliterationTest
- Tests Transliteration component functionality.
Namespace
Drupal\Tests\Component\TransliterationCode
public function testPhpTransliteration($langcode, $original, $expected, $unknown_character = '?', $max_length = NULL) {
$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.