function TwigMarkupInterfaceTest::testEmptyTranslation
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::testEmptyTranslation()
- 8.9.x core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::testEmptyTranslation()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::testEmptyTranslation()
Tests behavior if a string is translated to become an empty string.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigMarkupInterfaceTest.php, line 62
Class
- TwigMarkupInterfaceTest
- Tests Twig with MarkupInterface objects.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testEmptyTranslation() : void {
$settings = Settings::getAll();
$settings['locale_custom_strings_en'] = [
'' => [
'test' => '',
],
];
// Recreate the settings static.
new Settings($settings);
$variable = new TranslatableMarkup('test');
$this->assertEquals('', (string) $this->renderObjectWithTwig($variable));
$variable = new TranslatableMarkup('test', [], [
'langcode' => 'de',
]);
$this->assertEquals('<span>test</span>', (string) $this->renderObjectWithTwig($variable));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.