function PluralTranslatableMarkupTest::testExplicitCountArgument
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\PluralTranslatableMarkupTest::testExplicitCountArgument()
Tests that an explicit @count in the arguments takes precedence.
Attributes
#[DataProvider('providerExplicitCountArgument')]
File
-
core/
tests/ Drupal/ Tests/ Core/ StringTranslation/ PluralTranslatableMarkupTest.php, line 63
Class
- PluralTranslatableMarkupTest
- Tests the TranslatableMarkup class.
Namespace
Drupal\Tests\Core\StringTranslationCode
public function testExplicitCountArgument(int|float $count, string $explicit_count, string $expected_text) : void {
// Add a mock string translation service to the container.
$container = new ContainerBuilder();
$container->set('string_translation', $this->getStringTranslationStub());
\Drupal::setContainer($container);
$markup = new PluralTranslatableMarkup($count, 'singular @count', 'plural @count', [
'@count' => $explicit_count,
]);
$this->assertEquals($expected_text, $markup->render());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.