.../Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php index f7e6074..a791454 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php @@ -192,10 +192,11 @@ public function testExceptionEscaping() { $kernel = \Drupal::getContainer()->get('http_kernel'); $response = $kernel->handle($request)->prepare($request); // As the Content-type is text/plain the fact that the raw string is - // contained in the output does not matter. + // contained in the output would not matter, but because it is output by the + // final exception subscriber, it is printed as partial HTML, and hence + // escaped. $this->assertEqual($response->headers->get('Content-type'), 'text/plain; charset=UTF-8'); - $this->setRawContent($response->getContent()); - $this->assertRaw($string); + $this->assertStringStartsWith('The website encountered an unexpected error. Please try again later.

Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: Not acceptable format: json<script>alert(123);</script> in ', $response->getContent()); } }