/** * @small * test absolute URL construction * @dataProvider provideSubDirURLs */ function testGetAbsoluteURLSubDir($url, $expectedResult) { \OC::$WEBROOT = '/owncloud'; $urlGenerator = new \OC\URLGenerator(null); $result = $urlGenerator->getAbsoluteURL($url); $this->assertEquals($expectedResult, $result); }
/** * @small * test absolute URL construction * @dataProvider provideSubDirURLs */ function testGetAbsoluteURLSubDir($url, $expectedResult) { \OC::$WEBROOT = '/owncloud'; $config = $this->getMock('\\OCP\\IConfig'); $cacheFactory = $this->getMock('\\OCP\\ICacheFactory'); $urlGenerator = new \OC\URLGenerator($config, $cacheFactory); $result = $urlGenerator->getAbsoluteURL($url); $this->assertEquals($expectedResult, $result); }
<?php /** * @author Lukas Reschke * @copyright 2014 Lukas Reschke lukas@owncloud.com * * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ // This file is just used to redirect the legacy sharing URLs (< ownCloud 8) to the new ones $urlGenerator = new \OC\URLGenerator(\OC::$server->getConfig()); $token = isset($_GET['t']) ? $_GET['t'] : ''; $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare'; OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token)));