diff options
Diffstat (limited to 'tests/lib/UrlGeneratorTest.php')
-rw-r--r-- | tests/lib/UrlGeneratorTest.php | 30 |
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()); + } } |