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