public function TwigMarkupInterfaceTest::testEmptyTranslation in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::testEmptyTranslation()
- 9 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 67 - Contains \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest.
Class
- TwigMarkupInterfaceTest
- Tests Twig with MarkupInterface objects.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testEmptyTranslation() {
$settings = Settings::getAll();
$settings['locale_custom_strings_en'] = [
'' => [
'test' => '',
],
];
// Recreate the settings static.
new Settings($settings);
$variable = new TranslatableMarkup('test');
$this
->assertEquals('', $this
->renderObjectWithTwig($variable));
$variable = new TranslatableMarkup('test', [], [
'langcode' => 'de',
]);
$this
->assertEquals('<span>test</span>', $this
->renderObjectWithTwig($variable));
}