function TestControllers::removeExceptionLogger

Same name in other branches
  1. 9 core/modules/system/tests/modules/router_test_directory/src/TestControllers.php \Drupal\router_test\TestControllers::removeExceptionLogger()
  2. 8.9.x core/modules/system/tests/modules/router_test_directory/src/TestControllers.php \Drupal\router_test\TestControllers::removeExceptionLogger()
  3. 10 core/modules/system/tests/modules/router_test_directory/src/TestControllers.php \Drupal\router_test\TestControllers::removeExceptionLogger()
2 calls to TestControllers::removeExceptionLogger()
TestControllers::test10 in core/modules/system/tests/modules/router_test_directory/src/TestControllers.php
Tests controller for ExceptionHandlingTest::testBacktraceEscaping().
TestControllers::test24 in core/modules/system/tests/modules/router_test_directory/src/TestControllers.php

File

core/modules/system/tests/modules/router_test_directory/src/TestControllers.php, line 149

Class

TestControllers
Controller routines for testing the routing system.

Namespace

Drupal\router_test

Code

protected function removeExceptionLogger() {
    // Remove the exception logger from the event dispatcher. We are going to
    // throw an exception to check if it is properly escaped when rendered as a
    // backtrace. The exception logger does a call to error_log() which is not
    // handled by the test error handler and would cause a test failure.
    $event_dispatcher = \Drupal::service('event_dispatcher');
    $exception_logger = \Drupal::service('exception.logger');
    $event_dispatcher->removeSubscriber($exception_logger);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.