You are here

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

File

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

Class

ErrorHandlerTest
ErrorHandlerTest.

Namespace

Symfony\Component\Debug\Tests

Code

public function testRegister() {
  $handler = ErrorHandler::register();
  try {
    $this
      ->assertInstanceOf('Symfony\\Component\\Debug\\ErrorHandler', $handler);
    $this
      ->assertSame($handler, ErrorHandler::register());
    $newHandler = new ErrorHandler();
    $this
      ->assertSame($newHandler, ErrorHandler::register($newHandler, false));
    $h = set_error_handler('var_dump');
    restore_error_handler();
    $this
      ->assertSame(array(
      $handler,
      'handleError',
    ), $h);
    try {
      $this
        ->assertSame($newHandler, ErrorHandler::register($newHandler, true));
      $h = set_error_handler('var_dump');
      restore_error_handler();
      $this
        ->assertSame(array(
        $newHandler,
        'handleError',
      ), $h);
    } catch (\Exception $e) {
    }
    restore_error_handler();
    restore_exception_handler();
    if (isset($e)) {
      throw $e;
    }
  } catch (\Exception $e) {
  }
  restore_error_handler();
  restore_exception_handler();
  if (isset($e)) {
    throw $e;
  }
}