You are here

public function ErrorHandlerTest::testDefaultLogger in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/debug/Tests/ErrorHandlerTest.php \Symfony\Component\Debug\Tests\ErrorHandlerTest::testDefaultLogger()

File

vendor/symfony/debug/Tests/ErrorHandlerTest.php, line 131

Class

ErrorHandlerTest
ErrorHandlerTest.

Namespace

Symfony\Component\Debug\Tests

Code

public function testDefaultLogger() {
  try {
    $handler = ErrorHandler::register();
    $logger = $this
      ->getMock('Psr\\Log\\LoggerInterface');
    $handler
      ->setDefaultLogger($logger, E_NOTICE);
    $handler
      ->setDefaultLogger($logger, array(
      E_USER_NOTICE => LogLevel::CRITICAL,
    ));
    $loggers = array(
      E_DEPRECATED => array(
        null,
        LogLevel::INFO,
      ),
      E_USER_DEPRECATED => array(
        null,
        LogLevel::INFO,
      ),
      E_NOTICE => array(
        $logger,
        LogLevel::WARNING,
      ),
      E_USER_NOTICE => array(
        $logger,
        LogLevel::CRITICAL,
      ),
      E_STRICT => array(
        null,
        LogLevel::WARNING,
      ),
      E_WARNING => array(
        null,
        LogLevel::WARNING,
      ),
      E_USER_WARNING => array(
        null,
        LogLevel::WARNING,
      ),
      E_COMPILE_WARNING => array(
        null,
        LogLevel::WARNING,
      ),
      E_CORE_WARNING => array(
        null,
        LogLevel::WARNING,
      ),
      E_USER_ERROR => array(
        null,
        LogLevel::CRITICAL,
      ),
      E_RECOVERABLE_ERROR => array(
        null,
        LogLevel::CRITICAL,
      ),
      E_COMPILE_ERROR => array(
        null,
        LogLevel::CRITICAL,
      ),
      E_PARSE => array(
        null,
        LogLevel::CRITICAL,
      ),
      E_ERROR => array(
        null,
        LogLevel::CRITICAL,
      ),
      E_CORE_ERROR => array(
        null,
        LogLevel::CRITICAL,
      ),
    );
    $this
      ->assertSame($loggers, $handler
      ->setLoggers(array()));
    restore_error_handler();
    restore_exception_handler();
  } catch (\Exception $e) {
    restore_error_handler();
    restore_exception_handler();
    throw $e;
  }
}