public function TranslationManagerTest::testTranslatePlaceholder in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::testTranslatePlaceholder()
- 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::testTranslatePlaceholder()
Tests translation using placeholders.
@dataProvider providerTestTranslatePlaceholder
Parameters
string $string: A string containing the English text to translate.
array $args: An associative array of replacements to make after translation.
string $expected_string: The expected translated string value.
File
- core/
tests/ Drupal/ Tests/ Core/ StringTranslation/ TranslationManagerTest.php, line 81 - Contains \Drupal\Tests\Core\StringTranslation\TranslationManagerTest.
Class
- TranslationManagerTest
- @coversDefaultClass \Drupal\Core\StringTranslation\TranslationManager @group StringTranslation
Namespace
Drupal\Tests\Core\StringTranslationCode
public function testTranslatePlaceholder($string, array $args, $expected_string) {
$actual = $this->translationManager
->translate($string, $args);
$this
->assertInstanceOf(MarkupInterface::class, $actual);
$this
->assertEquals($expected_string, (string) $actual);
}