aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-12-04 21:35:32 +0100
committerGitHub <noreply@github.com>2023-12-04 21:35:32 +0100
commit636c94016ad8038ec88d8a6ce16a1bec7030e9d7 (patch)
tree63c51a4dd0fe35a2f5cd28a92595747f02fc6a48 /tests
parent604ba3aa6d46d362af94f4eb103b499cd49ba7bf (diff)
parent187c956c12cdee7f93cfc2467cb41f48095208cd (diff)
downloadnextcloud-server-636c94016ad8038ec88d8a6ce16a1bec7030e9d7.tar.gz
nextcloud-server-636c94016ad8038ec88d8a6ce16a1bec7030e9d7.zip
Merge pull request #41627 from nextcloud/backport/41616/stable26
[stable26] fix: Fix linkToOCSRouteAbsolute() without index.php and with subfolder
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/UrlGeneratorTest.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 523616b4532..619631fc930 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -192,26 +192,34 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @dataProvider provideOCSRoutes
*/
- public function testLinkToOCSRouteAbsolute(string $route, string $expected) {
+ public function testLinkToOCSRouteAbsolute(string $route, bool $ignoreFrontController, string $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
$this->router->expects($this->once())
->method('generate')
- ->willReturnCallback(function ($routeName, $parameters) {
+ ->willReturnCallback(function (string $routeName, array $parameters) use ($ignoreFrontController) {
if ($routeName === 'ocs.core.OCS.getCapabilities') {
- return '/index.php/ocsapp/cloud/capabilities';
+ if (!$ignoreFrontController) {
+ return '/nextcloud/index.php/ocsapp/cloud/capabilities';
+ }
+ return '/nextcloud/ocsapp/cloud/capabilities';
} elseif ($routeName === 'ocs.core.WhatsNew.dismiss') {
- return '/index.php/ocsapp/core/whatsnew';
+ if (!$ignoreFrontController) {
+ return '/nextcloud/index.php/ocsapp/core/whatsnew';
+ }
+ return '/nextcloud/ocsapp/core/whatsnew';
}
});
$result = $this->urlGenerator->linkToOCSRouteAbsolute($route);
$this->assertEquals($expected, $result);
}
- public function provideOCSRoutes() {
+ public function provideOCSRoutes(): array {
return [
- ['core.OCS.getCapabilities', 'http://localhost/nextcloud/ocs/v2.php/cloud/capabilities'],
- ['core.WhatsNew.dismiss', 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'],
+ ['core.OCS.getCapabilities', false, 'http://localhost/nextcloud/ocs/v2.php/cloud/capabilities'],
+ ['core.OCS.getCapabilities', true, 'http://localhost/nextcloud/ocs/v2.php/cloud/capabilities'],
+ ['core.WhatsNew.dismiss', false, 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'],
+ ['core.WhatsNew.dismiss', true, 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'],
];
}