예제 #1
0
 /**
  * Test the setScheme method.
  *
  * @return  void
  *
  * @since   1.0
  * @covers  Joomla\Uri\Uri::setScheme
  */
 public function testSetScheme()
 {
     $this->object->setScheme('ftp');
     $this->assertThat($this->object->getScheme(), $this->equalTo('ftp'));
 }
예제 #2
0
 /**
  * Give a relative path, return path with host.
  *
  * @param   string $path A system path.
  *
  * @return  string  Path with host added.
  */
 public static function pathAddHost($path)
 {
     if (!$path) {
         return '';
     }
     // Build path
     $uri = new Uri($path);
     if ($uri->getHost()) {
         return $path;
     }
     $uri = new Uri(\JUri::root());
     $root_path = $uri->getPath();
     if (strpos($path, $root_path) === 0) {
         $num = Utf8String::strlen($root_path);
         $path = Utf8String::substr($path, $num);
     }
     $uri->setPath($uri->getPath() . $path);
     $uri->setScheme('http');
     $uri->setQuery(null);
     return $uri->toString();
 }