diff options
Diffstat (limited to 'tests/lib/OCS')
-rw-r--r-- | tests/lib/OCS/ApiHelperTest.php | 9 | ||||
-rw-r--r-- | tests/lib/OCS/DiscoveryServiceTest.php | 9 | ||||
-rw-r--r-- | tests/lib/OCS/ProviderTest.php | 16 |
3 files changed, 17 insertions, 17 deletions
diff --git a/tests/lib/OCS/ApiHelperTest.php b/tests/lib/OCS/ApiHelperTest.php index fdbc1f4c538..334fca7169e 100644 --- a/tests/lib/OCS/ApiHelperTest.php +++ b/tests/lib/OCS/ApiHelperTest.php @@ -14,10 +14,7 @@ use OC\OCS\ApiHelper; use OCP\IRequest; class ApiHelperTest extends \Test\TestCase { - /** - * @return array - */ - public function versionDataScriptNameProvider(): array { + public static function versionDataScriptNameProvider(): array { return [ // Valid script name [ @@ -37,9 +34,7 @@ class ApiHelperTest extends \Test\TestCase { ]; } - /** - * @dataProvider versionDataScriptNameProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('versionDataScriptNameProvider')] public function testIsV2(string $scriptName, bool $expected): void { $request = $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor() diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php index 3db3163e11d..422c97f4221 100644 --- a/tests/lib/OCS/DiscoveryServiceTest.php +++ b/tests/lib/OCS/DiscoveryServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -35,17 +36,17 @@ class DiscoveryServiceTest extends TestCase { } /** - * @dataProvider dataTestIsSafeUrl * * @param string $url * @param bool $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsSafeUrl')] public function testIsSafeUrl($url, $expected): void { $result = $this->invokePrivate($this->discoveryService, 'isSafeUrl', [$url]); $this->assertSame($expected, $result); } - public function dataTestIsSafeUrl() { + public static function dataTestIsSafeUrl(): array { return [ ['api/ocs/v1.php/foo', true], ['/api/ocs/v1.php/foo', true], @@ -58,18 +59,18 @@ class DiscoveryServiceTest extends TestCase { } /** - * @dataProvider dataTestGetEndpoints * * @param array $decodedServices * @param string $service * @param array $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetEndpoints')] public function testGetEndpoints($decodedServices, $service, $expected): void { $result = $this->invokePrivate($this->discoveryService, 'getEndpoints', [$decodedServices, $service]); $this->assertSame($expected, $result); } - public function dataTestGetEndpoints() { + public static function dataTestGetEndpoints(): array { return [ [['services' => ['myService' => ['endpoints' => []]]], 'myService', []], [['services' => ['myService' => ['endpoints' => ['foo' => '/bar']]]], 'myService', ['foo' => '/bar']], diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php index ce028ce764a..87e01d8301b 100644 --- a/tests/lib/OCS/ProviderTest.php +++ b/tests/lib/OCS/ProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -8,11 +9,14 @@ namespace Test\OCS; use OC\OCS\Provider; +use OCP\App\IAppManager; +use OCP\AppFramework\Http\JSONResponse; +use OCP\IRequest; class ProviderTest extends \Test\TestCase { - /** @var \OCP\IRequest */ + /** @var IRequest */ private $request; - /** @var \OCP\App\IAppManager */ + /** @var IAppManager */ private $appManager; /** @var Provider */ private $ocsProvider; @@ -36,7 +40,7 @@ class ProviderTest extends \Test\TestCase { ['provisioning_api', null, false], ]); - $expected = new \OCP\AppFramework\Http\JSONResponse( + $expected = new JSONResponse( [ 'version' => 2, 'services' => [ @@ -66,7 +70,7 @@ class ProviderTest extends \Test\TestCase { ['provisioning_api', null, false], ]); - $expected = new \OCP\AppFramework\Http\JSONResponse( + $expected = new JSONResponse( [ 'version' => 2, 'services' => [ @@ -109,7 +113,7 @@ class ProviderTest extends \Test\TestCase { ['provisioning_api', null, false], ]); - $expected = new \OCP\AppFramework\Http\JSONResponse( + $expected = new JSONResponse( [ 'version' => 2, 'services' => [ @@ -142,7 +146,7 @@ class ProviderTest extends \Test\TestCase { ->method('isEnabledForUser') ->willReturn(true); - $expected = new \OCP\AppFramework\Http\JSONResponse( + $expected = new JSONResponse( [ 'version' => 2, 'services' => [ |