-
';
- $this->assertSame($expected, FieldFilteredString::displayAllowedTags());
+ $this->assertSame($expected, FieldFilteredMarkup::displayAllowedTags());
}
}
diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
index 6ac118acc2e0ac6a636a29fb427ea3e1d01660a4..7a90abb045545bdbfd0d2f28d916578697785cc4 100644
--- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php
@@ -8,7 +8,7 @@
namespace Drupal\Tests\Core\Menu;
use Drupal\Core\Menu\ContextualLinkDefault;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
@@ -71,7 +71,7 @@ protected function setupContextualLinkDefault() {
*/
public function testGetTitle() {
$title = 'Example';
- $this->pluginDefinition['title'] = (new TranslatableString($title, [], [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup($title, [], [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -86,7 +86,7 @@ public function testGetTitle() {
*/
public function testGetTitleWithContext() {
$title = 'Example';
- $this->pluginDefinition['title'] = (new TranslatableString($title, array(), array('context' => 'context'), $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup($title, array(), array('context' => 'context'), $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -101,7 +101,7 @@ public function testGetTitleWithContext() {
*/
public function testGetTitleWithTitleArguments() {
$title = 'Example @test';
- $this->pluginDefinition['title'] = (new TranslatableString($title, array('@test' => 'value'), [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup($title, array('@test' => 'value'), [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
index 25bf093305f94f644f88783fb17da48d5491771a..1d1c4dd72906c6581d808917d1fb24b69fec30d7 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionDefaultTest.php
@@ -8,7 +8,7 @@
namespace Drupal\Tests\Core\Menu;
use Drupal\Core\Menu\LocalActionDefault;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
@@ -83,7 +83,7 @@ protected function setupLocalActionDefault() {
* @see \Drupal\Core\Menu\LocalTaskDefault::getTitle()
*/
public function testGetTitle() {
- $this->pluginDefinition['title'] = (new TranslatableString('Example', [], [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [], [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -99,7 +99,7 @@ public function testGetTitle() {
* @see \Drupal\Core\Menu\LocalTaskDefault::getTitle()
*/
public function testGetTitleWithContext() {
- $this->pluginDefinition['title'] = (new TranslatableString('Example', array(), array('context' => 'context'), $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', array(), array('context' => 'context'), $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -113,7 +113,7 @@ public function testGetTitleWithContext() {
* Tests the getTitle method with title arguments.
*/
public function testGetTitleWithTitleArguments() {
- $this->pluginDefinition['title'] = (new TranslatableString('Example @test', array('@test' => 'value'), [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup('Example @test', array('@test' => 'value'), [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
index 51ff248ab2af339a6c1563ebee37308c58827b8b..005add6f6110ea6f496a8276fcd3c03cac8d0f54 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
@@ -10,7 +10,7 @@
use Drupal\Core\Menu\LocalTaskDefault;
use Drupal\Core\Routing\RouteMatch;
use Drupal\Core\Routing\RouteProviderInterface;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Route;
@@ -233,7 +233,7 @@ public function testActive() {
* @covers ::getTitle
*/
public function testGetTitle() {
- $this->pluginDefinition['title'] = (new TranslatableString('Example', [], [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [], [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -248,7 +248,7 @@ public function testGetTitle() {
*/
public function testGetTitleWithContext() {
$title = 'Example';
- $this->pluginDefinition['title'] = (new TranslatableString($title, array(), array('context' => 'context'), $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup($title, array(), array('context' => 'context'), $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
@@ -262,7 +262,7 @@ public function testGetTitleWithContext() {
* @covers ::getTitle
*/
public function testGetTitleWithTitleArguments() {
- $this->pluginDefinition['title'] = (new TranslatableString('Example @test', array('@test' => 'value'), [], $this->stringTranslation));
+ $this->pluginDefinition['title'] = (new TranslatableMarkup('Example @test', array('@test' => 'value'), [], $this->stringTranslation));
$this->stringTranslation->expects($this->once())
->method('translateString')
->with($this->pluginDefinition['title'])
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php
index 32144f3df733cb497e9a9243f222b123f5821f80..0dd3ab38fbf50122e5d4ad1bd4d0086f1d873f36 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php
@@ -7,7 +7,7 @@
namespace Drupal\Tests\Core\Plugin\Discovery;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
use org\bovigo\vfs\vfsStream;
@@ -104,9 +104,9 @@ public function testGetDefinitionsWithTranslatableDefinitions() {
$plugin_1 = $definitions['test_plugin'];
$plugin_2 = $definitions['test_plugin2'];
- $this->assertInstanceOf(TranslatableString::class, $plugin_1['title']);
+ $this->assertInstanceOf(TranslatableMarkup::class, $plugin_1['title']);
$this->assertEquals([], $plugin_1['title']->getOptions());
- $this->assertInstanceOf(TranslatableString::class, $plugin_2['title']);
+ $this->assertInstanceOf(TranslatableMarkup::class, $plugin_2['title']);
$this->assertEquals(['context' => 'test-context'], $plugin_2['title']->getOptions());
}
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
index a83b825b987a2c1bf88340a29fe1f036c665cb11..fdd4e28ff4993a01bf449ebd087dce583f117869 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
@@ -7,7 +7,7 @@
namespace Drupal\Tests\Core\Render\Element;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Render\Element\HtmlTag;
@@ -86,7 +86,7 @@ public function providerPreRenderHtmlTag() {
// Ensure that #value is not filtered if it is marked as safe.
$element = array(
'#tag' => 'p',
- '#value' => SafeString::create(''),
+ '#value' => Markup::create(''),
);
$tags[] = array($element, "
\n");
@@ -106,8 +106,8 @@ public function providerPreRenderHtmlTag() {
*/
public function testPreRenderConditionalComments($element, $expected, $set_safe = FALSE) {
if ($set_safe) {
- $element['#prefix'] = SafeString::create($element['#prefix']);
- $element['#suffix'] = SafeString::create($element['#suffix']);
+ $element['#prefix'] = Markup::create($element['#prefix']);
+ $element['#suffix'] = Markup::create($element['#suffix']);
}
$this->assertEquals($expected, HtmlTag::preRenderConditionalComments($element));
}
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
index 4f3e9c938aab8749e5c73b0f247274cd061fed0e..649a57f9d7ab1d8e86878133636a4dfd8fd3e6d3 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
@@ -10,7 +10,7 @@
use Drupal\Core\Form\FormState;
use Drupal\Core\Link;
use Drupal\Core\Render\Element\Tableselect;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\StringTranslation\TranslationWrapper;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
@@ -68,7 +68,7 @@ public function testProcessTableselectWithStringTitle() {
Tableselect::processTableselect($element, $form_state, $complete_form);
- $this->assertEquals(new TranslatableString('Update @title', ['@title' => 'Static title']), $element[0]['#title']);
+ $this->assertEquals(new TranslatableMarkup('Update @title', ['@title' => 'Static title']), $element[0]['#title']);
}
}
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
index e2bc876962bdd3d32111783e4c436cc890a1ddc3..d32ba5ad1f2272590e5e3916936251195af53b6a 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
@@ -10,7 +10,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Render\Element;
use Drupal\Core\Cache\Cache;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
/**
* @coversDefaultClass \Drupal\Core\Render\Renderer
@@ -70,10 +70,10 @@ public function providerPlaceholders() {
$token_render_array['#cache']['keys'] = $cache_keys;
}
$token = hash('crc32b', serialize($token_render_array));
- // \Drupal\Core\Render\SafeString::create() is necessary as the render
+ // \Drupal\Core\Render\Markup::create() is necessary as the render
// system would mangle this markup. As this is exactly what happens at
// runtime this is a valid use-case.
- return SafeString::create(' ');
+ return Markup::create(' ');
};
$extract_placeholder_render_array = function ($placeholder_render_array) {
@@ -852,7 +852,7 @@ public function testScalarLazybuilderCallbackContext() {
]];
$result = $this->renderer->renderRoot($element);
- $this->assertInstanceOf('\Drupal\Core\Render\SafeString', $result);
+ $this->assertInstanceOf('\Drupal\Core\Render\Markup', $result);
$this->assertEquals('This is a rendered placeholder!
', (string) $result);
}
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
index 4d0dec5f2f8eb2f91593736e5e677467a65db4cd..673b78d9d47b631092bbc4b051bc26ddaab68ca1 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
@@ -13,7 +13,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Render\Element;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Template\Attribute;
/**
@@ -111,7 +111,7 @@ public function providerTestRenderBasic() {
], '<em>foo</em>'];
// Safe strings in #plain_text are are still escaped.
$data[] = [[
- '#plain_text' => SafeString::create('foo'),
+ '#plain_text' => Markup::create('foo'),
], '<em>foo</em>'];
// Renderable child element.
$data[] = [[
@@ -737,10 +737,10 @@ public function testRenderCacheProperties(array $expected_results) {
],
// Collect expected property names.
'#cache_properties' => array_keys(array_filter($expected_results)),
- 'child1' => ['#markup' => SafeString::create('1')],
- 'child2' => ['#markup' => SafeString::create('2')],
+ 'child1' => ['#markup' => Markup::create('1')],
+ 'child2' => ['#markup' => Markup::create('2')],
// Mark the value as safe.
- '#custom_property' => SafeString::create('custom_value'),
+ '#custom_property' => Markup::create('custom_value'),
'#custom_property_array' => ['custom value'],
];
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableStringTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
similarity index 83%
rename from core/tests/Drupal/Tests/Core/StringTranslation/TranslatableStringTest.php
rename to core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
index 862a78a7b9fddbf574fce01121cc46e48e6cb117..0b243ccd5e4871ac89575e789c2ea6f10668e88e 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableStringTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
@@ -2,22 +2,22 @@
/**
* @file
- * Contains \Drupal\Tests\Core\StringTranslation\TranslatableStringTest.
+ * Contains \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest.
*/
namespace Drupal\Tests\Core\StringTranslation;
use Drupal\Core\StringTranslation\TranslationInterface;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
/**
- * Tests the TranslatableString class.
+ * Tests the TranslatableMarkup class.
*
- * @coversDefaultClass \Drupal\Core\StringTranslation\TranslatableString
+ * @coversDefaultClass \Drupal\Core\StringTranslation\TranslatableMarkup
* @group StringTranslation
*/
-class TranslatableStringTest extends UnitTestCase {
+class TranslatableMarkupTest extends UnitTestCase {
/**
* The error message of the last error in the error handler.
@@ -59,7 +59,7 @@ public function testToString() {
$translation = $this->getMock(TranslationInterface::class);
$string = 'May I have an exception please?';
- $text = $this->getMockBuilder(TranslatableString::class)
+ $text = $this->getMockBuilder(TranslatableMarkup::class)
->setConstructorArgs([$string, [], [], $translation])
->setMethods(['_die'])
->getMock();
@@ -82,7 +82,7 @@ public function testToString() {
restore_error_handler();
$this->assertEquals(E_USER_ERROR, $this->lastErrorNumber);
- $this->assertRegExp('/Exception thrown while calling __toString on a .*Mock_TranslatableString_.* object in .*TranslatableStringTest.php on line [0-9]+: Yes you may./', $this->lastErrorMessage);
+ $this->assertRegExp('/Exception thrown while calling __toString on a .*Mock_TranslatableMarkup_.* object in .*TranslatableMarkupTest.php on line [0-9]+: Yes you may./', $this->lastErrorMessage);
}
}
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
index 730437b560af5becf86dfbdd4fffea554bef1ef4..305963daaa912539ae0e7035a06fc03dd98b6cea 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
@@ -8,7 +8,7 @@
namespace Drupal\Tests\Core\StringTranslation;
use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Component\Utility\SafeStringInterface;
+use Drupal\Component\Render\MarkupInterface;
use Drupal\Core\StringTranslation\TranslationManager;
use Drupal\Tests\UnitTestCase;
@@ -76,7 +76,7 @@ public function testFormatPlural($count, $singular, $plural, array $args = array
*/
public function testTranslatePlaceholder($string, array $args = array(), $expected_string) {
$actual = $this->translationManager->translate($string, $args);
- $this->assertInstanceOf(SafeStringInterface::class, $actual);
+ $this->assertInstanceOf(MarkupInterface::class, $actual);
$this->assertEquals($expected_string, (string) $actual);
}
diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
index fba778614e8d47d45115193d8b0d9e273d06f2ab..69941a95bed765316f40e9d4efbee8781d00d5f9 100644
--- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -8,12 +8,12 @@
namespace Drupal\Tests\Core\Template;
use Drupal\Component\Utility\Html;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Template\AttributeArray;
use Drupal\Core\Template\AttributeString;
use Drupal\Tests\UnitTestCase;
-use Drupal\Component\Utility\SafeStringInterface;
+use Drupal\Component\Render\MarkupInterface;
/**
* @coversDefaultClass \Drupal\Core\Template\Attribute
@@ -40,7 +40,7 @@ public function testConstructor() {
$this->assertEquals(new AttributeArray('class', array('example-class')), $attribute['class']);
// Test that safe string objects work correctly.
- $safe_string = $this->prophesize(SafeStringInterface::class);
+ $safe_string = $this->prophesize(MarkupInterface::class);
$safe_string->__toString()->willReturn('example-class');
$attribute = new Attribute(array('class' => $safe_string->reveal()));
$this->assertTrue(isset($attribute['class']));
@@ -367,10 +367,10 @@ public function providerTestAttributeValues() {
$data = [];
$string = '"> "';
- $data['safe-object-xss1'] = [['title' => SafeString::create($string)], ' title=""> alert(123)""'];
+ $data['safe-object-xss1'] = [['title' => Markup::create($string)], ' title=""> alert(123)""'];
$data['non-safe-object-xss1'] = [['title' => $string], ' title="' . Html::escape($string) . '"'];
$string = '">';
- $data['safe-object-xss2'] = [['title' => SafeString::create($string)], ' title="">alert(123)"'];
+ $data['safe-object-xss2'] = [['title' => Markup::create($string)], ' title="">alert(123)"'];
$data['non-safe-object-xss2'] = [['title' => $string], ' title="' . Html::escape($string) . '"'];
return $data;
diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
index d01641b448752687405b578a53900b82ecede8ca..13f46394fc13dc07cead38311c84db6a784bb86c 100644
--- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php
@@ -126,7 +126,7 @@ public function testFormatDate() {
}
/**
- * Tests the escaping of objects implementing SafeStringInterface.
+ * Tests the escaping of objects implementing MarkupInterface.
*
* @covers ::escapeFilter
*/
@@ -141,11 +141,11 @@ public function testSafeStringEscaping() {
$twig_extension = new TwigExtension($renderer);
// By default, TwigExtension will attempt to cast objects to strings.
- // Ensure objects that implement SafeStringInterface are unchanged.
- $safe_string = $this->getMock('\Drupal\Component\Utility\SafeStringInterface');
+ // Ensure objects that implement MarkupInterface are unchanged.
+ $safe_string = $this->getMock('\Drupal\Component\Render\MarkupInterface');
$this->assertSame($safe_string, $twig_extension->escapeFilter($twig, $safe_string, 'html', 'UTF-8', TRUE));
- // Ensure objects that do not implement SafeStringInterface are escaped.
+ // Ensure objects that do not implement MarkupInterface are escaped.
$string_object = new TwigExtensionTestString("");
$this->assertSame('<script>alert('here');</script>', $twig_extension->escapeFilter($twig, $string_object, 'html', 'UTF-8', TRUE));
}
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index 05f1af1deb15d2eb616e44a30b4ff037aa05c24f..e2ffb807d0c33d2685bb050ffafa8246c9738352 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -7,11 +7,11 @@
namespace Drupal\Tests\Core\Utility {
-use Drupal\Component\Utility\SafeStringInterface;
+use Drupal\Component\Render\MarkupInterface;
use Drupal\Core\GeneratedUrl;
use Drupal\Core\Language\Language;
use Drupal\Core\Link;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
use Drupal\Core\Utility\LinkGenerator;
use Drupal\Tests\UnitTestCase;
@@ -357,11 +357,11 @@ public function testGenerateWithHtml() {
), $result);
// Test that safe HTML is output inside the anchor tag unescaped. The
- // SafeString::create() call is an intentional unit test for the interaction
- // between SafeStringInterface and the LinkGenerator.
+ // Markup::create() call is an intentional unit test for the interaction
+ // between MarkupInterface and the LinkGenerator.
$url = new Url('test_route_5', array());
$url->setUrlGenerator($this->urlGenerator);
- $result = $this->linkGenerator->generate(SafeString::create('HTML output'), $url);
+ $result = $this->linkGenerator->generate(Markup::create('HTML output'), $url);
$this->assertLink(array(
'attributes' => array('href' => '/test-route-5'),
'child' => array(
@@ -499,12 +499,12 @@ public function testGenerateBubbleableMetadata() {
* An associative array of link properties, with the following keys:
* - attributes: optional array of HTML attributes that should be present.
* - content: optional link content.
- * @param \Drupal\Component\Utility\SafeStringInterface $html
+ * @param \Drupal\Component\Render\MarkupInterface $html
* The HTML to check.
* @param int $count
* How many times the link should be present in the HTML. Defaults to 1.
*/
- public static function assertLink(array $properties, SafeStringInterface $html, $count = 1) {
+ public static function assertLink(array $properties, MarkupInterface $html, $count = 1) {
// Provide default values.
$properties += array('attributes' => array());
diff --git a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
index e9021341193962488671627e4775dde0aa2b9255..60e378f644c7bdadbbaa72212d0831b25362c096 100644
--- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
@@ -12,7 +12,7 @@
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Render\BubbleableMetadata;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Utility\Token;
use Drupal\Tests\UnitTestCase;
@@ -292,7 +292,7 @@ public function providerTestReplaceEscaping() {
$data['simple-placeholder-with-safe-html'] = [
'[token:meh]
',
- ['[token:meh]' => SafeString::create('Emphasized')],
+ ['[token:meh]' => Markup::create('Emphasized')],
'Emphasized
',
];
diff --git a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
index 1183a2bc1235ed1dc813f281d69d3dfb68c436c5..34df3eff71b3231d6c92078602e8acfbb58b7407 100644
--- a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php
@@ -16,7 +16,7 @@
use Drupal\Core\TypedData\PrimitiveInterface;
use Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint;
use Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator;
-use Drupal\Core\StringTranslation\TranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
/**
@@ -64,7 +64,7 @@ public function provideTestValidate() {
$data[] = [new IntegerData(DataDefinition::create('integer')), 1.5, FALSE];
$data[] = [new IntegerData(DataDefinition::create('integer')), 'test', FALSE];
$data[] = [new StringData(DataDefinition::create('string')), 'test', TRUE];
- $data[] = [new StringData(DataDefinition::create('string')), new TranslatableString('test'), TRUE];
+ $data[] = [new StringData(DataDefinition::create('string')), new TranslatableMarkup('test'), TRUE];
// It is odd that 1 is a valid string.
// $data[] = [$this->getMock('Drupal\Core\TypedData\Type\StringInterface'), 1, FALSE];
$data[] = [new StringData(DataDefinition::create('string')), [], FALSE];
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 63098bb4aa52c4332143c6320179f33bccd21a44..64b631776bb96563a32a9820d8aa311e6a5f8cb5 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -12,8 +12,8 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\Core\StringTranslation\TranslatableString;
-use Drupal\Core\StringTranslation\PluralTranslatableString;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
/**
@@ -218,17 +218,17 @@ public function getStringTranslationStub() {
$translation->expects($this->any())
->method('translate')
->willReturnCallback(function ($string, array $args = array(), array $options = array()) use ($translation) {
- return new TranslatableString($string, $args, $options, $translation);
+ return new TranslatableMarkup($string, $args, $options, $translation);
});
$translation->expects($this->any())
->method('translateString')
- ->willReturnCallback(function (TranslatableString $wrapper) {
+ ->willReturnCallback(function (TranslatableMarkup $wrapper) {
return $wrapper->getUntranslatedString();
});
$translation->expects($this->any())
->method('formatPlural')
->willReturnCallback(function ($count, $singular, $plural, array $args = [], array $options = []) use ($translation) {
- $wrapper = new PluralTranslatableString($count, $singular, $plural, $args, $options, $translation);
+ $wrapper = new PluralTranslatableMarkup($count, $singular, $plural, $args, $options, $translation);
return $wrapper;
});
return $translation;
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine
index 977f09446d934138f0189ac4da113f98b52aad3f..44ee5ac6bfb609daf304991c6d4b0fdc5ac7a62e 100644
--- a/core/themes/engines/twig/twig.engine
+++ b/core/themes/engines/twig/twig.engine
@@ -7,7 +7,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Core\Render\SafeString;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Extension\Extension;
/**
@@ -46,7 +46,7 @@ function twig_init(Extension $theme) {
* @param array $variables
* A keyed array of variables that will appear in the output.
*
- * @return string|\Drupal\Component\Utility\SafeStringInterface
+ * @return string|\Drupal\Component\Render\MarkupInterface
* The output generated by the template, plus any debug information.
*/
function twig_render_template($template_file, array $variables) {
@@ -116,7 +116,7 @@ function twig_render_template($template_file, array $variables) {
$output['debug_suffix'] .= "\n\n\n";
}
// This output has already been rendered and is therefore considered safe.
- return SafeString::create(implode('', $output));
+ return Markup::create(implode('', $output));
}
/**