/** * testWithQuery * * @return void */ public function testWithQuery() { $uri = new PsrUri('https://*****:*****@local.example.com:3001/foo?bar=baz#quz'); $new = $uri->withQuery('baz=bat'); $this->assertNotSame($uri, $new); $this->assertEquals('baz=bat', $new->getQuery()); $this->assertEquals('https://*****:*****@local.example.com:3001/foo?baz=bat#quz', (string) $new); // Strip query symbol $uri = new PsrUri('http://example.com'); $new = $uri->withQuery('?foo=bar'); $this->assertEquals('foo=bar', $new->getQuery()); }