You are here

public function ErrorHandlerTest::testHandleDeprecation 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::testHandleDeprecation()

File

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

Class

ErrorHandlerTest
ErrorHandlerTest.

Namespace

Symfony\Component\Debug\Tests

Code

public function testHandleDeprecation() {
  $that = $this;
  $logArgCheck = function ($level, $message, $context) use ($that) {
    $that
      ->assertEquals(LogLevel::INFO, $level);
    $that
      ->assertArrayHasKey('level', $context);
    $that
      ->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']);
    $that
      ->assertArrayHasKey('stack', $context);
  };
  $logger = $this
    ->getMock('Psr\\Log\\LoggerInterface');
  $logger
    ->expects($this
    ->once())
    ->method('log')
    ->will($this
    ->returnCallback($logArgCheck));
  $handler = new ErrorHandler();
  $handler
    ->setDefaultLogger($logger);
  @$handler
    ->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array());
}