Example #1
0
 /**
  * Creates an absolute url for public use
  * @param string $service id
  * @return string the url
  * @since 4.5.0
  */
 public static function linkToPublic($service)
 {
     return \OC_Helper::linkToPublic($service);
 }
Example #2
0
 /**
  * @small
  * test linkToPublic URL construction
  */
 public function testLinkToPublic()
 {
     \OC::$WEBROOT = '';
     $result = \OC_Helper::linkToPublic('files');
     $this->assertEquals('http://localhost/s', $result);
     $result = \OC_Helper::linkToPublic('files', false);
     $this->assertEquals('http://localhost/s', $result);
     $result = \OC_Helper::linkToPublic('files', true);
     $this->assertEquals('http://localhost/s/', $result);
     $result = \OC_Helper::linkToPublic('other');
     $this->assertEquals('http://localhost/public.php?service=other', $result);
     $result = \OC_Helper::linkToPublic('other', false);
     $this->assertEquals('http://localhost/public.php?service=other', $result);
     $result = \OC_Helper::linkToPublic('other', true);
     $this->assertEquals('http://localhost/public.php?service=other/', $result);
     \OC::$WEBROOT = '/owncloud';
     $result = \OC_Helper::linkToPublic('files');
     $this->assertEquals('http://localhost/owncloud/s', $result);
     $result = \OC_Helper::linkToPublic('files', false);
     $this->assertEquals('http://localhost/owncloud/s', $result);
     $result = \OC_Helper::linkToPublic('files', true);
     $this->assertEquals('http://localhost/owncloud/s/', $result);
     $result = \OC_Helper::linkToPublic('other');
     $this->assertEquals('http://localhost/owncloud/public.php?service=other', $result);
     $result = \OC_Helper::linkToPublic('other', false);
     $this->assertEquals('http://localhost/owncloud/public.php?service=other', $result);
     $result = \OC_Helper::linkToPublic('other', true);
     $this->assertEquals('http://localhost/owncloud/public.php?service=other/', $result);
 }