You are here

public function HttpKernelTest::testTerminate 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::testTerminate()

File

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

Class

HttpKernelTest

Namespace

Symfony\Component\HttpKernel\Tests

Code

public function testTerminate() {
  $dispatcher = new EventDispatcher();
  $kernel = new HttpKernel($dispatcher, $this
    ->getResolver());
  $dispatcher
    ->addListener(KernelEvents::TERMINATE, function ($event) use (&$called, &$capturedKernel, &$capturedRequest, &$capturedResponse) {
    $called = true;
    $capturedKernel = $event
      ->getKernel();
    $capturedRequest = $event
      ->getRequest();
    $capturedResponse = $event
      ->getResponse();
  });
  $kernel
    ->terminate($request = Request::create('/'), $response = new Response());
  $this
    ->assertTrue($called);
  $this
    ->assertEquals($kernel, $capturedKernel);
  $this
    ->assertEquals($request, $capturedRequest);
  $this
    ->assertEquals($response, $capturedResponse);
}