public function testGetUrl() { $this->url->setScheme($this->getUrlPartMock(Scheme::class, 'https://')); $this->url->setUserInfo($this->getUrlPartMock(UserInfo::class, 'root:pass@')); $this->url->setHost($this->getUrlPartMock(Host::class, 'example.com')); $this->url->setPort($this->getUrlPartMock(Port::class, ':8080')); $this->url->setPath($this->getUrlPartMock(Path::class, '/test/path/')); $this->url->setQuery($this->getUrlPartMock(Query::class, '?key1=val1&key2=val2')); $this->url->setFragment($this->getUrlPartMock(Fragment::class, '#fragment')); $this->assertEquals('https://*****:*****@example.com:8080/test/path/?key1=val1&key2=val2#fragment', $this->url->getUrl()); }
/** * @param array|string $path * @param bool $replace * * @return $this * @throws \Exception */ public function path($path, $replace = true) { if ($this->_url->path) { $this->_url->path->setPath($path, $replace); } else { $this->_url->setPath((new Path())->setPath($path)); } return $this; }