/** * @test */ public function handleResetsTheCancelParameterIfItWasTrue() { $mockComponent1 = $this->getMockBuilder(Http\Component\ComponentInterface::class)->getMock(); $this->mockComponentContext->expects($this->at(1))->method('getParameter')->with(Http\Component\ComponentChain::class, 'cancel')->will($this->returnValue(true)); $this->mockComponentContext->expects($this->at(2))->method('setParameter')->with(Http\Component\ComponentChain::class, 'cancel', null); $options = ['components' => [$mockComponent1]]; $this->componentChain = new Http\Component\ComponentChain($options); $this->componentChain->handle($this->mockComponentContext); }
/** * Handles a HTTP request * * @return void */ public function handleRequest() { // Create the request very early so the ResourceManagement has a chance to grab it: $request = Request::createFromEnvironment(); $response = new Response(); $this->componentContext = new ComponentContext($request, $response); $this->boot(); $this->resolveDependencies(); $this->addPoweredByHeader($response); if (isset($this->settings['http']['baseUri'])) { $request->setBaseUri(new Uri($this->settings['http']['baseUri'])); } $this->baseComponentChain->handle($this->componentContext); $response = $this->baseComponentChain->getResponse(); $response->send(); $this->bootstrap->shutdown(Bootstrap::RUNLEVEL_RUNTIME); $this->exit->__invoke(); }