function PluralTranslatableMarkupTest::testPluralTranslatableMarkupSerialization
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\PluralTranslatableMarkupTest::testPluralTranslatableMarkupSerialization()
- 10 core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\PluralTranslatableMarkupTest::testPluralTranslatableMarkupSerialization()
- 11.x core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\PluralTranslatableMarkupTest::testPluralTranslatableMarkupSerialization()
Tests serialization of PluralTranslatableMarkup().
@dataProvider providerPluralTranslatableMarkupSerialization
File
-
core/
tests/ Drupal/ Tests/ Core/ StringTranslation/ PluralTranslatableMarkupTest.php, line 22
Class
- PluralTranslatableMarkupTest
- Tests the TranslatableMarkup class.
Namespace
Drupal\Tests\Core\StringTranslationCode
public function testPluralTranslatableMarkupSerialization($count, $expected_text) {
// Add a mock string translation service to the container.
$container = new ContainerBuilder();
$container->set('string_translation', $this->getStringTranslationStub());
\Drupal::setContainer($container);
// Create an object to serialize and unserialize.
$markup = new PluralTranslatableMarkup($count, 'singular @count', 'plural @count');
$serialized_markup = unserialize(serialize($markup));
$this->assertEquals($expected_text, $serialized_markup->render());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.