diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
index 35ccf0c..7bb0fb1 100644
--- a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
+++ b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
@@ -88,4 +88,14 @@ public function error() {
];
}
+ /**
+ * Renders a page with encoded markup.
+ *
+ * @return array
+ * A render array as expected by drupal_render()
+ */
+ public function renderEncodedMarkup() {
+ return ['#plain_text' => 'Bad html '];
+ }
+
}
diff --git a/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml b/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml
index a2d5ed5..cbcf6d8 100644
--- a/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml
+++ b/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml
@@ -58,3 +58,11 @@ test_page_test.error:
code: 200
requirements:
_access: 'TRUE'
+
+test_page_test.encoded:
+ path: '/test-encoded'
+ defaults:
+ _title: 'Page with encoded HTML'
+ _controller: '\Drupal\test_page_test\Controller\Test::renderEncodedMarkup'
+ requirements:
+ _access: 'TRUE'
diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
index 90bd144..3d59b76 100644
--- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
@@ -125,6 +125,7 @@ public function testAssertions() {
*/
public function testLegacyAsserts() {
$this->drupalGet('test-encoded');
+ $this->assertSession()->statusCodeEquals(200);
$dangerous = 'Bad html ';
$sanitized = Html::escape($dangerous);
$this->assertNoText($dangerous);