You are here

public function HttpKernelTest::testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener in Zircon Profile 8

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

File

vendor/symfony/http-kernel/Tests/HttpKernelTest.php, line 60

Class

HttpKernelTest

Namespace

Symfony\Component\HttpKernel\Tests

Code

public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener() {
  $exception = new \RuntimeException();
  $dispatcher = new EventDispatcher();
  $dispatcher
    ->addListener(KernelEvents::EXCEPTION, function ($event) {

    // should set a response, but does not
  });
  $kernel = new HttpKernel($dispatcher, $this
    ->getResolver(function () use ($exception) {
    throw $exception;
  }));
  try {
    $kernel
      ->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
    $this
      ->fail('LogicException expected');
  } catch (\RuntimeException $e) {
    $this
      ->assertSame($exception, $e);
  }
}