public function testConstructor() { $request = new Request('GET', new Uri('http://wani.kr')); $this->assertSame('http://wani.kr', $request->getUri()->__toString()); $request = new Request('GET', 'http://wani.kr'); $this->assertInstanceOf(UriInterface::class, $request->getUri()); $this->assertSame('http://wani.kr', $request->getUri()->__toString()); }
/** * ServerRequest constructor. * @param array $serverParams * @param array $queryParams * @param array $parsedBody * @param array $cookieParams * @param array $uploadedFiles * @param array $attributes * @param string $method * @param \Psr\Http\Message\UriInterface|string $uri * @param \Psr\Http\Message\StreamInterface|null $body * @param array $headers * @param string $protocolVersion */ public function __construct(array $serverParams = [], array $queryParams = [], array $parsedBody = [], array $cookieParams = [], array $uploadedFiles = [], array $attributes = [], $method = null, $uri = null, StreamInterface $body = null, array $headers = [], $protocolVersion = '1.1') { $this->validArrayOfUploadedFiles($uploadedFiles); $this->serverParams = $serverParams; $this->cookieParams = $cookieParams; $this->queryParams = $queryParams; $this->parsedBody = $parsedBody; $this->uploadedFiles = $uploadedFiles; $this->attributes = $attributes; parent::__construct($method, $uri, $body, $headers, $protocolVersion); }