public function testTarget() { $uri = new Uri('http://server.loc'); $stream = fopen('php://temp', 'wb+'); $streamObject = new Stream($stream); fclose($stream); $request = new Request('GET', $uri, $streamObject); $request2 = $request->withRequestTarget('foo'); $this->assertEquals('/', $request->getRequestTarget()); $this->assertEquals('foo', $request2->getRequestTarget()); $uri = new Uri('http://server.loc/foo?abc=123'); $request = new Request('GET', $uri, $streamObject); $this->assertEquals('/foo?abc=123', $request->getRequestTarget()); }
/** * Constructor * * @param string $method * @param UriInterface $uri * @param StreamInterface $body * @param array $headers * @param array $serverParams * @param array $cookieParams * @param array $uploadedFiles */ public function __construct($method, UriInterface $uri, StreamInterface $body, array $headers = [], array $serverParams = [], array $cookieParams = [], array $uploadedFiles = []) { parent::__construct($method, $uri, $body, $headers); $this->serverParams = $serverParams; $this->cookieParams = $cookieParams; $this->uploadedFiles = $uploadedFiles; }