public function testUri() { $uri = new Uri('https://*****:*****@local.example.com:3001/foo?bar=baz#quz'); $this->assertEquals('https', $uri->getScheme()); $this->assertEquals('user:pass', $uri->getUserInfo()); $this->assertEquals('local.example.com', $uri->getHost()); $this->assertEquals(3001, $uri->getPort()); $this->assertEquals('user:pass@local.example.com:3001', $uri->getAuthority()); $this->assertEquals('/foo', $uri->getPath()); $this->assertEquals('bar=baz', $uri->getQuery()); $this->assertEquals('quz', $uri->getFragment()); }
/** * Retrieves the message's request target. * * Retrieves the message's request-target either as it will appear (for * clients), as it appeared at request (for servers), or as it was * specified for the instance (see withRequestTarget()). * * In most cases, this will be the origin-form of the composed URI, * unless a value was provided to the concrete implementation (see * withRequestTarget() below). * * If no URI is available, and no request-target has been specifically * provided, this method MUST return the string "/". * * @return string */ public function getRequestTarget() { return $this->uri->getPath(); }