You are here

public function StackedHttpKernelTest::terminateShouldDelegateToMiddlewares in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/stack/builder/tests/unit/Stack/StackedHttpKernelTest.php \Stack\StackedHttpKernelTest::terminateShouldDelegateToMiddlewares()

@test

File

vendor/stack/builder/tests/unit/Stack/StackedHttpKernelTest.php, line 39

Class

StackedHttpKernelTest

Namespace

Stack

Code

public function terminateShouldDelegateToMiddlewares() {
  $first = new TerminableKernelSpy();
  $second = new TerminableKernelSpy($first);
  $third = new KernelSpy($second);
  $fourth = new TerminableKernelSpy($third);
  $fifth = new TerminableKernelSpy($fourth);
  $kernel = new StackedHttpKernel($fifth, $middlewares = array(
    $fifth,
    $fourth,
    $third,
    $second,
    $first,
  ));
  $request = Request::create('/');
  $response = $kernel
    ->handle($request);
  $kernel
    ->terminate($request, $response);
  $this
    ->assertTerminablesCalledOnce($middlewares);
}