Esempio n. 1
0
 /**
  * @dataProvider urlsProvider
  */
 public function testBasicHasGoodTermination($url, $status)
 {
     if ($status) {
         $this->assertTrue(UrlParserA::hasGoodTermination($url));
     } else {
         $this->assertFalse(UrlParserA::hasGoodTermination($url));
     }
 }
Esempio n. 2
0
 /**
  * @return string
  */
 public function getModulePath()
 {
     $sModulePath = $this->getPath();
     if (!SiteMapA::isValidMapPath($sModulePath) && SiteMapA::isValidObjectPath($sModulePath)) {
         $sModulePath = $this->getModuleMap()->getModulePath();
     }
     if (!UrlParserA::hasGoodTermination($sModulePath, DIRECTORY_SEPARATOR)) {
         $sModulePath .= DIRECTORY_SEPARATOR;
     }
     return $sModulePath;
 }
Esempio n. 3
0
 public function testBasicIsAbsolutePath()
 {
     $test1 = '/';
     $test2 = uniqid('/');
     $test3 = uniqid('asd:');
     $test4 = 'ana/are/mere';
     $this->assertTrue(UrlParserA::isAbsolutePath($test1));
     $this->assertTrue(UrlParserA::isAbsolutePath($test2));
     $this->assertFalse(UrlParserA::isAbsolutePath($test3));
     $this->assertFalse(UrlParserA::isAbsolutePath($test4));
 }
Esempio n. 4
0
 /**
  * @return string
  */
 public function getPath()
 {
     return UrlParserA::normalizePath($this->path);
 }
Esempio n. 5
0
 public function testEmptyWithCustomRequest()
 {
     $_SERVER = ['HTTP_HOST' => 'example.com', 'REQUEST_URI' => '/test/' . uniqid()];
     $uri = sprintf('http://%s%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']);
     $this->assertEquals($uri, UrlParserA::getRequestUri());
 }
Esempio n. 6
0
 public static function parse_url($sUrl = null)
 {
     return parent::parse_url($sUrl);
 }
Esempio n. 7
0
 private function getResourcePath($sPath)
 {
     if (is_file($this->getModulePath() . $sPath)) {
         $sPath = $this->getModulePath() . $sPath;
     }
     $oUrl = UrlParserA::url($sPath);
     if ($oUrl->isLocal()) {
         // I had a bad habit of correcting external URL's
         $sPath = $oUrl->getPath();
     }
     return $sPath;
 }
Esempio n. 8
0
 /**
  * @return Url
  */
 public function getUriObject()
 {
     if (!Url::isValid($this->oUri)) {
         $this->oUri = UrlParserA::url($this->getUri());
     }
     return $this->oUri;
 }
Esempio n. 9
0
 /**
  * @returns UrlRWParser
  */
 public static function getUriParser()
 {
     if (!UrlParserA::isValid(self::$oUriParser)) {
         self::$oUriParser = new UrlRWParser();
     }
     return self::$oUriParser;
 }