You are here

public function PhpTransliterationTest::testPhpTransliteration in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 95
Contains \Drupal\Tests\Component\Transliteration\PhpTransliterationTest.

Class

PhpTransliterationTest
Tests Transliteration component functionality.

Namespace

Drupal\Tests\Component\Transliteration

Code

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);
}