diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-04 21:06:00 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-09 15:41:50 +0200 |
commit | c97b4274ccdc4fa841b164dedb608fdf351a0412 (patch) | |
tree | 562862bfafb4840ec2265712965bc1eb621a44f9 /tests/lib/UrlGeneratorTest.php | |
parent | 877823eb9dc08f0675bb1183d35cbb1918348712 (diff) | |
download | nextcloud-server-c97b4274ccdc4fa841b164dedb608fdf351a0412.tar.gz nextcloud-server-c97b4274ccdc4fa841b164dedb608fdf351a0412.zip |
Add function to generate urls for OCS routes
fixes #11617
The OCS routes are only absolute for now as they are often exposed to
the outside anyway and are on a different endpoint than index.php in
anyway.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/UrlGeneratorTest.php')
-rw-r--r-- | tests/lib/UrlGeneratorTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index 340c9c7082d..0e50f4d92ec 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -162,4 +162,22 @@ class UrlGeneratorTest extends \Test\TestCase { $this->assertEquals($expected, $actual); } + /** + * @dataProvider provideOCSRoutes + */ + public function testLinkToOCSRouteAbsolute(string $route, string $expected) { + $this->mockBaseUrl(); + \OC::$WEBROOT = '/nextcloud'; + $result = $this->urlGenerator->linkToOCSRouteAbsolute($route); + $this->assertEquals($expected, $result); + } + + public function provideOCSRoutes() { + return [ + ['core.OCS.getCapabilities', 'http://localhost/nextcloud/ocs/v2.php/cloud/capabilities'], + ['core.WhatsNew.dismiss', 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'], + ]; + } + + } |