diff -u b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php --- b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php @@ -39,11 +39,13 @@ $this->assertEqual(\Drupal::state()->get('_system_test_first_shutdown_function'), array($arg1, $arg2)); $this->assertEqual(\Drupal::state()->get('_system_test_second_shutdown_function'), array($arg1, $arg2)); - if (!function_exists('fastcgi_finish_request')) { - // If using PHP-FPM then fastcgi_finish_request() will have been fired - // preventing further output to the browser. Make sure exceptions - // displayed through \Drupal\Core\Utility\Error::renderExceptionSafe() are - // correctly escaped. + // If using PHP-FPM then fastcgi_finish_request() will have been fired + // preventing further output to the browser. + // @see \Drupal\system_test\Controller\SystemTestController::shutdownFunctions() + if (strpos($this->drupalGetContent(), 'The function fastcgi_finish_request exists when serving the request.') === FALSE) { + // Make sure exceptions displayed through + // \Drupal\Core\Utility\Error::renderExceptionSafe() are correctly + // escaped. $this->assertRaw('Drupal is <blink>awesome</blink>.'); } } only in patch2: unchanged: --- a/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php +++ b/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php @@ -68,6 +68,14 @@ public function setHeader() { */ public function shutdownFunctions($arg1, $arg2) { system_test_page_shutdown_functions($arg1, $arg2); + // If using PHP-FPM then fastcgi_finish_request() will have been fired + // preventing further output to the browser which means that the escaping of + // the exception message can not be tested. + // @see _drupal_shutdown_function() + // @see \Drupal\system\Tests\System\ShutdownFunctionsTest + if (function_exists('fastcgi_finish_request')) { + return 'The function fastcgi_finish_request exists when serving the request.'; + } } }