public function testBasicSetPath() { $value = uniqid('test:'); $url = new Url(); $url->setPath($value); $this->assertEquals($value, $url->getPath()); }
/** * @param string $sPath * @returns UrlParserA */ public function addPath($sPath) { $sExistingPath = $this->oUrl->getPath(); if (substr($sExistingPath, -1) != '/') { $sPath = '/' . $sPath; } $this->oUrl->setPath($sExistingPath . $sPath); return $this; }
/** * @returns Url */ public function getUrl() { $sRegex = '#(' . str_replace('#', '\\#', $this->getRegex()) . ')#iUu'; $bHaveMatch = preg_match($sRegex, $this->sMatchingUrl, $aMatches); if ($bHaveMatch) { $url = new Url(); $url->setPath($aMatches[0]); return $url; } else { return new Base(); } }
/** * @test */ public function parse_urlIPWithoutProtocol() { $aUrlComponents = array('scheme' => 'http', 'host' => '127.0.0.1', 'user' => '', 'pass' => '', 'path' => '/', 'query' => [], 'fragment' => ''); $oUrl = new Url(); $oUrl->setScheme($aUrlComponents['scheme']); $oUrl->setHost($aUrlComponents['host']); $oUrl->setPath($aUrlComponents['path']); $oUrl->setQuery($aUrlComponents['query']); $oUrl->setFragment($aUrlComponents['fragment']); $this->assertEquals($oUrl, UrlParserA_underTest::parse_url('//127.0.0.1/')); }
public function testIsLocal() { $oUrl = new Url(); $oUrl->setPath(__FILE__); $this->assertTrue($oUrl->isLocal()); }