public function testImmutabilityIsMaintainedWhenInstantiated() { $request = new Request($symfonyRequest = new SymfonyRequest()); $symfonyRequest->headers->add(array('X-mutable' => 'true')); $header = $request->getHeader('X-mutable'); $this->assertEquals($header, null); }
<?php require __DIR__ . '/../../vendor/autoload.php'; use Silex\Application; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; use SamBurns\Psr7Symfony\Request; $app = new Silex\Application(); $app->get('/what-was-the-user-agent/', function (SymfonyRequest $request) { $adaptedRequest = new Request($request); return serialize($adaptedRequest->getHeader('User-Agent')); }); $app->run();
/** * @When I check the URI */ public function iCheckTheUri() { $requestAdapter = new Request($this->symfonyRequest); $this->result = (string) $requestAdapter->getUri(); }