/** * @test */ public function it_can_override_the_response_header_argument_with_the_response_header_method() { $this->requestIdGenerator->expects($this->any())->method('generate')->will($this->returnValue('yolo')); $alternateStackedApp = new RequestId($this->app, $this->requestIdGenerator, $this->header, 'Bad-Request-Id'); $alternateStackedApp->enableResponseHeader('Good-Request-Id'); $response = $alternateStackedApp->handle($this->CreateRequest()); $this->assertFalse($response->headers->has('Bad-Request-Id')); $this->assertTrue($response->headers->has('Good-Request-Id')); }
<?php /* * This file is part of the broadway/broadway-demo package. * * (c) Qandidate.com <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use Qandidate\Stack\RequestId; use Qandidate\Stack\UuidRequestIdGenerator; use Symfony\Component\HttpFoundation\Request; $loader = (require __DIR__ . '/../vendor/autoload.php'); require __DIR__ . '/../app/AppKernel.php'; $debug = true; $environment = 'dev'; $kernel = new AppKernel($environment, $debug); // Stack it! $generator = new UuidRequestIdGenerator(42); $requestId = new RequestId($kernel, $generator); $kernel->loadClassCache(); $request = Request::createFromGlobals(); $response = $requestId->handle($request); $response->send(); $kernel->terminate($request, $response);