Ejemplo n.º 1
0
 /** @test */
 public function terminateShouldDelegateToMiddlewares()
 {
     $app = $this->getTerminableMock(new Response('ok'));
     $foo = $this->getTerminableMock();
     $bar = $this->getTerminableMock();
     $kernel = new StackedHttpKernel($app, array($app, $foo, $bar));
     $request = Request::create('/');
     $response = $kernel->handle($request);
     $kernel->terminate($request, $response);
 }
 /** @test */
 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);
 }
Ejemplo n.º 3
0
 /**
  * @param Request  $request
  * @param Response $response
  */
 public function terminate(Request $request, Response $response)
 {
     if ($this->stack instanceof TerminableInterface) {
         $this->stack->terminate($request, $response);
     }
 }