public function testChangeQueryWithFragmentWithQuestionMark() { $url = new \webignition\Url\Url('http://example.com/?key1=value1#fragment'); $url->setQuery('?key1=value2'); $this->assertEquals('key1=value2', (string) $url->getQuery()); $this->assertEquals('http://example.com/?key1=value2#fragment', (string) $url); }
/** * When setting a fragment to null in a url that had a fragment * and then setting the query to null where there was no query * was resulting in the fragment containing the string '?', this is incorrect */ public function testReplaceFragmentWithNullSetNullQuery() { $url = new \webignition\Url\Url('http://example.com/#fragment'); $url->setFragment(null); $url->setQuery(null); $this->assertNull($url->getFragment()); $this->assertNull($url->getQuery()); $this->assertEquals("http://example.com/", (string) $url); }