You are here

public function TranslationManagerTest::testTranslatePlaceholder in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 82
Contains \Drupal\Tests\Core\StringTranslation\TranslationManagerTest.

Class

TranslationManagerTest
@coversDefaultClass \Drupal\Core\StringTranslation\TranslationManager @group StringTranslation

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testTranslatePlaceholder($string, array $args = array(), $expected_string) {
  $actual = $this->translationManager
    ->translate($string, $args);
  $this
    ->assertInstanceOf(MarkupInterface::class, $actual);
  $this
    ->assertEquals($expected_string, (string) $actual);
}