public function ErrorHandlerTest::testHandle

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php, line 37

Class

ErrorHandlerTest
ErrorHandlerTest

Namespace

Symfony\Component\HttpKernel\Tests\Debug

Code

public function testHandle() {
  $handler = ErrorHandler::register(0);
  $this
    ->assertFalse($handler
    ->handle(0, 'foo', 'foo.php', 12, 'foo'));
  restore_error_handler();
  $handler = ErrorHandler::register(3);
  $this
    ->assertFalse($handler
    ->handle(4, 'foo', 'foo.php', 12, 'foo'));
  restore_error_handler();
  $handler = ErrorHandler::register(3);
  try {
    $handler
      ->handle(1, 'foo', 'foo.php', 12, 'foo');
  } catch (\ErrorException $e) {
    $this
      ->assertSame('1: foo in foo.php line 12', $e
      ->getMessage());
    $this
      ->assertSame(1, $e
      ->getSeverity());
    $this
      ->assertSame('foo.php', $e
      ->getFile());
    $this
      ->assertSame(12, $e
      ->getLine());
  }
  restore_error_handler();
}