public function testSetFragmentWithHash() { $url = new \webignition\Url\Url('http://example.com/'); $url->setFragment('#fragment'); $this->assertEquals('fragment', $url->getFragment()); $this->assertEquals('http://example.com/#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); }