/** * testWithFragment * * @return void */ public function testWithFragment() { $uri = new PsrUri('https://*****:*****@local.example.com:3001/foo?bar=baz#quz'); $new = $uri->withFragment('qat'); $this->assertNotSame($uri, $new); $this->assertEquals('qat', $new->getFragment()); $this->assertEquals('https://*****:*****@local.example.com:3001/foo?bar=baz#qat', (string) $new); $uri = new PsrUri('http://example.com'); $new = $uri->withFragment('#/foo/bar'); $this->assertEquals('/foo/bar', $new->getFragment()); }