aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/UrlGeneratorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/UrlGeneratorTest.php')
-rw-r--r--tests/lib/UrlGeneratorTest.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 7006c3948f6..4320efc4190 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -8,6 +9,7 @@
namespace Test;
use OC\Route\Router;
+use OC\URLGenerator;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IRequest;
@@ -42,7 +44,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->request = $this->createMock(IRequest::class);
$this->router = $this->createMock(Router::class);
- $this->urlGenerator = new \OC\URLGenerator(
+ $this->urlGenerator = new URLGenerator(
$this->config,
$this->userSession,
$this->cacheFactory,
@@ -69,8 +71,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test linkTo URL construction
- * @dataProvider provideDocRootAppUrlParts
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootAppUrlParts')]
public function testLinkToDocRoot($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '';
$result = $this->urlGenerator->linkTo($app, $file, $args);
@@ -80,17 +82,15 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test linkTo URL construction in sub directory
- * @dataProvider provideSubDirAppUrlParts
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirAppUrlParts')]
public function testLinkToSubDir($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->linkTo($app, $file, $args);
$this->assertEquals($expectedResult, $result);
}
- /**
- * @dataProvider provideRoutes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideRoutes')]
public function testLinkToRouteAbsolute($route, $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -133,8 +133,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test absolute URL construction
- * @dataProvider provideDocRootURLs
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootURLs')]
public function testGetAbsoluteURLDocRoot($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '';
@@ -145,8 +145,8 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
* test absolute URL construction
- * @dataProvider provideSubDirURLs
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirURLs')]
public function testGetAbsoluteURLSubDir($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -188,9 +188,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertEquals(\OC::$WEBROOT, $actual);
}
- /**
- * @dataProvider provideOCSRoutes
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('provideOCSRoutes')]
public function testLinkToOCSRouteAbsolute(string $route, bool $ignoreFrontController, string $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
@@ -275,9 +273,7 @@ class UrlGeneratorTest extends \Test\TestCase {
];
}
- /**
- * @dataProvider imagePathProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('imagePathProvider')]
public function testImagePath(string $appName, string $file, string $result): void {
$this->assertSame($result, $this->urlGenerator->imagePath($appName, $file));
}