Issue #3294076 by longwave: Remove unused ExceptionTestSiteSubscriber
(cherry picked from commit bc8f01f49d)
merge-requests/2475/head
parent
03e037d86f
commit
d0ab08fb9e
|
|
@ -1332,10 +1332,6 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: event_subscriber }
|
- { name: event_subscriber }
|
||||||
arguments: ['@config.factory', '@http_kernel']
|
arguments: ['@config.factory', '@http_kernel']
|
||||||
exception.test_site:
|
|
||||||
class: Drupal\Core\EventSubscriber\ExceptionTestSiteSubscriber
|
|
||||||
tags:
|
|
||||||
- { name: event_subscriber }
|
|
||||||
exception.enforced_form_response:
|
exception.enforced_form_response:
|
||||||
class: Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber
|
class: Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber
|
||||||
tags:
|
tags:
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Drupal\Core\EventSubscriber;
|
|
||||||
|
|
||||||
use Drupal\Core\Utility\Error;
|
|
||||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom handling of errors when in a system-under-test.
|
|
||||||
*/
|
|
||||||
class ExceptionTestSiteSubscriber extends HttpExceptionSubscriberBase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected static function getPriority() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function getHandledFormats() {
|
|
||||||
return ['html'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks for special handling of errors inside Simpletest.
|
|
||||||
*
|
|
||||||
* @todo The $headers array appears to not actually get used at all in the
|
|
||||||
* original code. It's quite possible that this entire method is now
|
|
||||||
* vestigial and can be removed.
|
|
||||||
*
|
|
||||||
* @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event
|
|
||||||
* The event.
|
|
||||||
*/
|
|
||||||
public function on500(ExceptionEvent $event) {
|
|
||||||
$exception = $event->getThrowable();
|
|
||||||
$error = Error::decodeException($exception);
|
|
||||||
|
|
||||||
$headers = [];
|
|
||||||
|
|
||||||
// When running inside the testing framework, we relay the errors
|
|
||||||
// to the tested site by the way of HTTP headers.
|
|
||||||
if (DRUPAL_TEST_IN_CHILD_SITE && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) {
|
|
||||||
// $number does not use drupal_static as it should not be reset
|
|
||||||
// as it uniquely identifies each PHP error.
|
|
||||||
static $number = 0;
|
|
||||||
$assertion = [
|
|
||||||
$error['@message'],
|
|
||||||
$error['%type'],
|
|
||||||
[
|
|
||||||
'function' => $error['%function'],
|
|
||||||
'file' => $error['%file'],
|
|
||||||
'line' => $error['%line'],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
$headers['X-Drupal-Assertion-' . $number] = rawurlencode(serialize($assertion));
|
|
||||||
$number++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue