diff --git a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
index 11a5493..12e8536 100644
--- a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
+++ b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
@@ -9,6 +9,7 @@
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\ToStringTrait;
+use Drupal\Component\Utility\Unicode;
/**
* Provides translatable markup class.
diff --git a/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php
new file mode 100644
index 0000000..c8b5d3c
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php
@@ -0,0 +1,58 @@
+executeInRenderContext($context, function () use ($renderer, $variable) {
+ $elements = [
+ '#type' => 'inline_template',
+ '#template' => '{%- if variable is not empty -%}{{ variable }}{%- endif -%}',
+ '#context' => array('variable' => $variable),
+ ];
+ return $renderer->render($elements);
+ });
+ $this->assertEquals($expected, $output);
+ }
+
+ /**
+ * Provide test examples.
+ */
+ public function providerTestMarkupInterfaceEmpty() {
+ return [
+ 'empty TranslatableMarkup' => ['', new TranslatableMarkup('')],
+ 'non-empty TranslatableMarkup' => ['test', new TranslatableMarkup('test')],
+ 'empty FormattableMarkup' => ['', new FormattableMarkup('', ['@foo' => 'bar'])],
+ 'non-empty FormattableMarkup' => ['bar', new FormattableMarkup('@foo', ['@foo' => 'bar'])],
+ 'non-empty Markup' => ['test', Markup::create('test')],
+ 'empty Attribute' => ['', new Attribute()],
+ 'non-empty Attribute' => [' id="test"', new Attribute(['id' => 'test'])],
+ ];
+ }
+
+}