aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/UrlGeneratorTest.php
diff options
context:
space:
mode:
authorDaniel Rudolf <github.com@daniel-rudolf.de>2021-06-30 16:16:05 +0200
committerDaniel Rudolf <github.com@daniel-rudolf.de>2021-06-30 16:20:57 +0200
commit12059eb65b5f72974aab05f81ded890ebd73daab (patch)
tree7da1e4baa80a27ccda958beeb8636aa3dc381102 /tests/lib/UrlGeneratorTest.php
parent75f7287b5ed7251599fd6c67ff3ae319f6a3dfc2 (diff)
downloadnextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.tar.gz
nextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.zip
Add IUrlGenerator::linkToDefaultPageUrl()
Replaces the deprecated \OC_Util::getDefaultPageUrl() and makes this API public. Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'tests/lib/UrlGeneratorTest.php')
-rw-r--r--tests/lib/UrlGeneratorTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index dd2eb2ddc63..732aa2d2a27 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -204,4 +204,34 @@ class UrlGeneratorTest extends \Test\TestCase {
['core.WhatsNew.dismiss', 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'],
];
}
+
+ public function testGetDefaultPageUrlWithRedirectUrlWithoutFrontController() {
+ putenv('front_controller_active=false');
+ \OC::$server->getConfig()->deleteSystemValue('htaccess.IgnoreFrontController');
+
+ $_REQUEST['redirect_url'] = 'myRedirectUrl.com';
+ $this->assertSame('http://localhost'.\OC::$WEBROOT.'/myRedirectUrl.com', $this->urlGenerator->linkToDefaultPageUrl());
+ }
+
+ public function testGetDefaultPageUrlWithRedirectUrlRedirectBypassWithoutFrontController() {
+ putenv('front_controller_active=false');
+ \OC::$server->getConfig()->deleteSystemValue('htaccess.IgnoreFrontController');
+
+ $_REQUEST['redirect_url'] = 'myRedirectUrl.com@foo.com:a';
+ $this->assertSame('http://localhost'.\OC::$WEBROOT.'/index.php/apps/files/', $this->urlGenerator->linkToDefaultPageUrl());
+ }
+
+ public function testGetDefaultPageUrlWithRedirectUrlRedirectBypassWithFrontController() {
+ putenv('front_controller_active=true');
+ $_REQUEST['redirect_url'] = 'myRedirectUrl.com@foo.com:a';
+ $this->assertSame('http://localhost'.\OC::$WEBROOT.'/apps/files/', $this->urlGenerator->linkToDefaultPageUrl());
+ }
+
+ public function testGetDefaultPageUrlWithRedirectUrlWithIgnoreFrontController() {
+ putenv('front_controller_active=false');
+ \OC::$server->getConfig()->setSystemValue('htaccess.IgnoreFrontController', true);
+
+ $_REQUEST['redirect_url'] = 'myRedirectUrl.com@foo.com:a';
+ $this->assertSame('http://localhost'.\OC::$WEBROOT.'/apps/files/', $this->urlGenerator->linkToDefaultPageUrl());
+ }
}