diff options
Diffstat (limited to 'tests/lib/AppFramework/Http')
11 files changed, 25 insertions, 33 deletions
diff --git a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php index aa2b29418e4..75527e7eaf8 100644 --- a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 4ed6627891c..86c78e840e0 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -32,7 +32,7 @@ use Psr\Log\LoggerInterface; class TestController extends Controller { /** * @param string $appName - * @param \OCP\IRequest $request + * @param IRequest $request */ public function __construct($appName, $request) { parent::__construct($appName, $request); @@ -547,9 +547,7 @@ class DispatcherTest extends \Test\TestCase { ]; } - /** - * @dataProvider rangeDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('rangeDataProvider')] public function testEnsureParameterValueSatisfiesRange(int $min, int $max, int $input, bool $throw): void { $this->reflector = $this->createMock(ControllerMethodReflector::class); $this->reflector->expects($this->any()) diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index cf179ba270b..b2f60edd999 100644 --- a/tests/lib/AppFramework/Http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -27,9 +27,7 @@ class DownloadResponseTest extends \Test\TestCase { $this->assertEquals('content', $headers['Content-Type']); } - /** - * @dataProvider filenameEncodingProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('filenameEncodingProvider')] public function testFilenameEncoding(string $input, string $expected): void { $response = new ChildDownloadResponse($input, 'content'); $headers = $response->getHeaders(); diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index 3110f632fa7..66abce43cc4 100644 --- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php index 5f602b2e1c6..029ddaad712 100644 --- a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php +++ b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index 703e6d89dd1..56f67b23f0d 100644 --- a/tests/lib/AppFramework/Http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -58,10 +58,10 @@ class JSONResponseTest extends \Test\TestCase { } /** - * @dataProvider renderDataProvider * @param array $input * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('renderDataProvider')] public function testRender(array $input, $expected): void { $this->json->setData($input); $this->assertEquals($expected, $this->json->render()); diff --git a/tests/lib/AppFramework/Http/OutputTest.php b/tests/lib/AppFramework/Http/OutputTest.php index 58b17c08141..2ba93833dd1 100644 --- a/tests/lib/AppFramework/Http/OutputTest.php +++ b/tests/lib/AppFramework/Http/OutputTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 91259b26c9f..7340391b2d5 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 781cca256ec..a7ff123fc25 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -259,9 +260,7 @@ class RequestTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataNotJsonData - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataNotJsonData')] public function testNotJsonPost(string $testData): void { global $data; $data = $testData; @@ -708,9 +707,7 @@ class RequestTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataGetRemoteAddress - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetRemoteAddress')] public function testGetRemoteAddress(array $headers, array $trustedProxies, array $forwardedForHeaders, string $expected): void { $this->config ->method('getSystemValue') @@ -759,11 +756,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataHttpProtocol * * @param mixed $input * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataHttpProtocol')] public function testGetHttpProtocol($input, $expected): void { $request = new Request( [ @@ -949,11 +946,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataUserAgent * @param string $testAgent * @param array $userAgent * @param bool $matches */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUserAgent')] public function testUserAgent($testAgent, $userAgent, $matches): void { $request = new Request( [ @@ -971,11 +968,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataUserAgent * @param string $testAgent * @param array $userAgent * @param bool $matches */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUserAgent')] public function testUndefinedUserAgent($testAgent, $userAgent, $matches): void { $request = new Request( [], @@ -1153,11 +1150,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataMatchClientVersion * @param string $testAgent * @param string $userAgent * @param string $version */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataMatchClientVersion')] public function testMatchClientVersion(string $testAgent, string $userAgent, string $version): void { preg_match($userAgent, $testAgent, $matches); @@ -1372,9 +1369,7 @@ class RequestTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataGetServerHostTrustedDomain - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetServerHostTrustedDomain')] public function testGetServerHostTrustedDomain(string $expected, $trustedDomain): void { $this->config ->method('getSystemValue') @@ -1484,11 +1479,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataGenericPathInfo * @param string $requestUri * @param string $scriptName * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGenericPathInfo')] public function testGetPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void { $request = new Request( [ @@ -1507,11 +1502,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataGenericPathInfo * @param string $requestUri * @param string $scriptName * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGenericPathInfo')] public function testGetRawPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void { $request = new Request( [ @@ -1530,11 +1525,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataRawPathInfo * @param string $requestUri * @param string $scriptName * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataRawPathInfo')] public function testGetRawPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void { $request = new Request( [ @@ -1553,11 +1548,11 @@ class RequestTest extends \Test\TestCase { } /** - * @dataProvider dataPathInfo * @param string $requestUri * @param string $scriptName * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataPathInfo')] public function testGetPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void { $request = new Request( [ @@ -1628,9 +1623,7 @@ class RequestTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataGetRequestUriWithOverwrite - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetRequestUriWithOverwrite')] public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot, $overwriteCondAddr, $remoteAddr = ''): void { $this->config ->expects($this->exactly(2)) @@ -2183,9 +2176,7 @@ class RequestTest extends \Test\TestCase { ]; } - /** - * @dataProvider dataInvalidToken - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataInvalidToken')] public function testPassesCSRFCheckWithInvalidToken(string $invalidToken): void { /** @var Request $request */ $request = $this->getMockBuilder(Request::class) diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 7750db921c6..4c76695f6e4 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -16,7 +16,7 @@ use OCP\AppFramework\Utility\ITimeFactory; class ResponseTest extends \Test\TestCase { /** - * @var \OCP\AppFramework\Http\Response + * @var Response */ private $childResponse; diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index ad0fe808b76..28f952e35e3 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -13,7 +13,7 @@ use OCP\AppFramework\Http\TemplateResponse; class TemplateResponseTest extends \Test\TestCase { /** - * @var \OCP\AppFramework\Http\TemplateResponse + * @var TemplateResponse */ private $tpl; |