You are here

public function HttpKernelTest::testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered in Zircon Profile 8.0

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

File

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

Class

HttpKernelTest

Namespace

Symfony\Component\HttpKernel\Tests

Code

public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered() {
  $dispatcher = new EventDispatcher();
  $dispatcher
    ->addListener(KernelEvents::VIEW, function ($event) {
    $event
      ->setResponse(new Response($event
      ->getControllerResult()));
  });
  $kernel = new HttpKernel($dispatcher, $this
    ->getResolver(function () {
    return 'foo';
  }));
  $this
    ->assertEquals('foo', $kernel
    ->handle(new Request())
    ->getContent());
}