function ExceptionLoggingSubscriberTest::exceptionDataProvider

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php \Drupal\KernelTests\Core\EventSubscriber\ExceptionLoggingSubscriberTest::exceptionDataProvider()

File

core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php, line 65

Class

ExceptionLoggingSubscriberTest
Tests that HTTP exceptions are logged correctly.

Namespace

Drupal\KernelTests\Core\EventSubscriber

Code

public static function exceptionDataProvider() : array {
    return [
        // When a BadRequestException is thrown, DefaultHttpExceptionSubscriber
        // will rethrow the exception.
[
            400,
            'client error',
            RfcLogLevel::WARNING,
            HttpException::class,
        ],
        [
            401,
            'client error',
            RfcLogLevel::WARNING,
        ],
        [
            403,
            'access denied',
            RfcLogLevel::WARNING,
        ],
        [
            404,
            'page not found',
            RfcLogLevel::WARNING,
        ],
        [
            405,
            'client error',
            RfcLogLevel::WARNING,
        ],
        [
            408,
            'client error',
            RfcLogLevel::WARNING,
        ],
        // Do not check the 500 status code here because it would be caught by
        // Drupal\Core\EventSubscriberExceptionTestSiteSubscriber which has lower
        // priority.
[
            501,
            'php',
            RfcLogLevel::ERROR,
        ],
        [
            502,
            'php',
            RfcLogLevel::ERROR,
        ],
        [
            503,
            'php',
            RfcLogLevel::ERROR,
        ],
    ];
}

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