diff --git a/core/modules/system/src/Tests/Theme/TwigTransTest.php b/core/modules/system/src/Tests/Theme/TwigTransTest.php index 9eec247..5e5dc1e 100644 --- a/core/modules/system/src/Tests/Theme/TwigTransTest.php +++ b/core/modules/system/src/Tests/Theme/TwigTransTest.php @@ -97,6 +97,27 @@ public function testTwigTransTags() { } /** + * Test empty Twig "trans" tags. + */ + public function testEmptyTwigTransTags() { + $elements = [ + '#type' => 'inline_template', + '#template' => '{% trans %}{% endtrans %}', + ]; + + try { + /** @var \Drupal\Core\Render\RendererInterface $renderer */ + $renderer = \Drupal::service('renderer'); + $markup = (string) $renderer->renderPlain($elements); + + $this->assertEqual('', $markup, '{% trans %}{% endtrans %} successfully translated.'); + } + catch (\Exception $e) { + $this->fail('{% trans %}{% endtrans %} not successfully translated.'); + } + } + + /** * Asserts Twig trans tags. */ protected function assertTwigTransTags() {