Exemple #1
0
 public function testBasicSetPath()
 {
     $value = uniqid('test:');
     $url = new Url();
     $url->setPath($value);
     $this->assertEquals($value, $url->getPath());
 }
Exemple #2
0
 /**
  * @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;
 }
Exemple #3
0
 /**
  * @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();
     }
 }
Exemple #4
0
 /**
  * @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/'));
 }
Exemple #5
0
 public function testIsLocal()
 {
     $oUrl = new Url();
     $oUrl->setPath(__FILE__);
     $this->assertTrue($oUrl->isLocal());
 }