diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php index 644de39..1f023ad 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php @@ -48,7 +48,7 @@ public function on500(GetResponseForExceptionEvent $event) { // When running inside the testing framework, we relay the errors // to the tested site by the way of HTTP headers. - if ($this->addHeaders()) { + if ($this->canAddHeaders()) { // $number does not use drupal_static as it should not be reset // as it uniquely identifies each PHP error. static $number = 0; @@ -72,8 +72,8 @@ public function on500(GetResponseForExceptionEvent $event) { * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The event to process. */ - public function onException(GetResponseEvent $event) { - if ($this->addHeaders()) { + public function onResponse(GetResponseEvent $event) { + if ($this->canAddHeaders()) { $response = $event->getResponse(); $memory_usage = memory_get_usage(); $response->headers->add([ @@ -98,8 +98,8 @@ public static function getSubscribedEvents() { * @return bool * TRUE if headers should be added. */ - protected function addHeaders() { - return (DRUPAL_TEST_IN_CHILD_SITE && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS) + protected function canAddHeaders() { + return (DRUPAL_TEST_IN_CHILD_SITE && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS); } } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 2146391..8733434 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1313,7 +1313,7 @@ protected function curlHeaderCallback($curlHandler, $header) { } if (!$this->ignoreMemoryUsage && preg_match('/^X-Drupal-Memory-Peak: (.*)$/', $header, $matches)) { if ((float) $matches[1] >= $this->memoryUsageTrigger) { - $this->fail(format_string('Child site memory usage (@siteMB) exceeded acceptable maximum (@maxMB) on url @url', [ + $this->fail(SafeMarkup::format('Child site memory usage (@siteMB) exceeded acceptable maximum (@maxMB) on url @url', [ '@url' => $this->getUrl(), '@site' => $matches[1], '@max' => $this->memoryUsageTrigger,