public function testWithQueryParams() { $url = new Uri('/hello?foo=30&bar=&baz'); static::assertEquals('/hello?foo=30&bar=&baz', $url->__toString()); static::assertEquals('/hello?foo=40&bar=&baz=', $url->withQueryParam('foo', 40)->__toString()); static::assertEquals('/hello?foo=kkk+hhh&bar=&baz=', $url->withQueryParam('foo', 'kkk hhh')->__toString()); static::assertEquals('/hello?bar=&baz=', $url->withQueryParam('foo', null)->__toString()); static::assertEquals('/hello?bar=&baz=', $url->withoutQueryParam('foo')->__toString()); static::assertEquals('/hello?foo=30&baz=', $url->withoutQueryParam('bar')->__toString()); $url = new Uri('/hello?foo=30&bar=&baz'); static::assertEquals('/hello?foo=30&bar=&baz', $url->__toString()); static::assertEquals('/hello?foo=40&bar=&baz=', $url->withQueryParam('foo', 40)->__toString()); static::assertEquals('/hello?bar=&baz=', $url->withQueryParam('foo', null)->__toString()); static::assertEquals('/hello?foo=30&bar=&baz=&qux=40&quux=50', $url->withQueryParam('qux', 40)->withQueryParam('quux', 50)->__toString()); static::assertEquals('/hello?bar=&baz=', $url->withoutQueryParam('foo')->__toString()); static::assertEquals('/hello?foo=30&baz=', $url->withoutQueryParam('bar')->__toString()); }