You are here

public function ExceptionListenerTest::testHandleWithLogger in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php \Symfony\Component\HttpKernel\Tests\EventListener\ExceptionListenerTest::testHandleWithLogger()

@dataProvider provider

File

vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php, line 67

Class

ExceptionListenerTest
ExceptionListenerTest.

Namespace

Symfony\Component\HttpKernel\Tests\EventListener

Code

public function testHandleWithLogger($event, $event2) {
  $logger = new TestLogger();
  $l = new ExceptionListener('foo', $logger);
  $l
    ->onKernelException($event);
  $this
    ->assertEquals(new Response('foo'), $event
    ->getResponse());
  try {
    $l
      ->onKernelException($event2);
    $this
      ->fail('RuntimeException expected');
  } catch (\RuntimeException $e) {
    $this
      ->assertSame('bar', $e
      ->getMessage());
    $this
      ->assertSame('foo', $e
      ->getPrevious()
      ->getMessage());
  }
  $this
    ->assertEquals(3, $logger
    ->countErrors());
  $this
    ->assertCount(3, $logger
    ->getLogs('critical'));
}