From e57832e73d03f38498ac2d2225c870d216f38bfc Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 12:49:13 +0100 Subject: [PATCH 01/14] Update to PHP 8.3.3, Redmine 5.0.8 and Redmine 5.1.2 --- .docker/PHP83-Dockerfile | 2 +- docker-compose.yml | 18 +++++++++--------- tests/Behat/behat.yml | 6 +++--- tests/RedmineExtension/RedmineInstance.php | 4 ++-- tests/RedmineExtension/RedmineVersion.php | 17 +++++++++++++++++ 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.docker/PHP83-Dockerfile b/.docker/PHP83-Dockerfile index 8b8c348e..4b2ffa60 100644 --- a/.docker/PHP83-Dockerfile +++ b/.docker/PHP83-Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3.1-fpm +FROM php:8.3.3-fpm RUN apt-get update RUN apt-get --yes --no-install-recommends install \ diff --git a/docker-compose.yml b/docker-compose.yml index 11861779..8ba6c8a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - ./:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.* redmine-dev: - image: redmine:5.1.1 + image: redmine:5.1.2 user: "1000:1000" ports: - "3000:3000" @@ -26,8 +26,8 @@ services: # Make sure the following services are supported in /tests/RedmineExtension/RedmineInstance.php - redmine-50101: - image: redmine:5.1.1 + redmine-50102: + image: redmine:5.1.2 user: "1000:1000" ports: - "5101:3000" @@ -35,11 +35,11 @@ services: REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - ./.docker/redmine-50101_data/files:/usr/src/redmine/files - - ./.docker/redmine-50101_data/sqlite:/usr/src/redmine/sqlite + - ./.docker/redmine-50102_data/files:/usr/src/redmine/files + - ./.docker/redmine-50102_data/sqlite:/usr/src/redmine/sqlite - redmine-50007: - image: redmine:5.0.7 + redmine-50008: + image: redmine:5.0.8 user: "1000:1000" ports: - "5007:3000" @@ -47,5 +47,5 @@ services: REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - ./.docker/redmine-50007_data/files:/usr/src/redmine/files - - ./.docker/redmine-50007_data/sqlite:/usr/src/redmine/sqlite + - ./.docker/redmine-50008_data/files:/usr/src/redmine/files + - ./.docker/redmine-50008_data/sqlite:/usr/src/redmine/sqlite diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index cf006462..5d346abf 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -1,14 +1,14 @@ default: suites: - redmine_50101: + redmine_50102: paths: - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: - redmineVersion: '5.1.1' + redmineVersion: '5.1.2' redmine_50007: paths: - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: - redmineVersion: '5.0.7' + redmineVersion: '5.0.8' diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index 14bc684b..70575843 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -16,8 +16,8 @@ final class RedmineInstance public static function getSupportedVersions(): array { return [ - RedmineVersion::V5_1_1, - RedmineVersion::V5_0_7, + RedmineVersion::V5_1_2, + RedmineVersion::V5_0_8, ]; } diff --git a/tests/RedmineExtension/RedmineVersion.php b/tests/RedmineExtension/RedmineVersion.php index 8a4c6afd..214aa39c 100644 --- a/tests/RedmineExtension/RedmineVersion.php +++ b/tests/RedmineExtension/RedmineVersion.php @@ -6,6 +6,14 @@ enum RedmineVersion: string { + /** + * Redmine 5.1.2 + * + * @link https://www.redmine.org/versions/193 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_1#512-2024-03-04 + */ + case V5_1_2 = '5.1.2'; + /** * Redmine 5.1.1 * @@ -22,6 +30,15 @@ enum RedmineVersion: string */ case V5_1_0 = '5.1.0'; + /** + * Redmine 5.0.8 + * + * @link https://www.redmine.org/versions/192 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#508-2024-03-04 + */ + + case V5_0_8 = '5.0.8'; + /** * Redmine 5.0.7 * From 73d19aa1d0fea2b452010f636f38e00839310615 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 12:50:35 +0100 Subject: [PATCH 02/14] update to codecov/codecov-action@v4 --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6bea5c4..c2e87261 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,9 +77,10 @@ jobs: - name: Upload coverage reports to Codecov if: ${{ matrix.tool == 'code-coverage' }} - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - token: ${{ secrets.CODECOV_TOKEN }} files: ./.phpunit.cache/clover.xml fail_ci_if_error: true verbose: true From c389eeaffcf14b2580d506174da91613036a8f6e Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 13:05:49 +0100 Subject: [PATCH 03/14] Fix behat tests --- tests/Behat/behat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index 5d346abf..ee6fb477 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -6,7 +6,7 @@ default: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.2' - redmine_50007: + redmine_50008: paths: - '%paths.base%/features' contexts: From a6261029c1ee0a302f174f354bffea773c01c64f Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 13:06:25 +0100 Subject: [PATCH 04/14] Switch back to token as parameter for codecov --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2e87261..f5dda41b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -78,9 +78,8 @@ jobs: - name: Upload coverage reports to Codecov if: ${{ matrix.tool == 'code-coverage' }} uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: + token: ${{ secrets.CODECOV_TOKEN }} files: ./.phpunit.cache/clover.xml fail_ci_if_error: true verbose: true From a78098f74f182ebc95b9d77388b445531426b3ce Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 14:17:07 +0100 Subject: [PATCH 05/14] replace deprecated PHPUnit method returnCallback() with willReturnCallback --- .../Psr18ClientRequestGenerationTest.php | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index ad8efb45..9c5cc8ed 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -35,41 +35,37 @@ public function testPsr18ClientCreatesCorrectRequests( $response = $this->createMock(ResponseInterface::class); $httpClient = $this->createMock(ClientInterface::class); - $httpClient->method('sendRequest')->will( - $this->returnCallback(function ($request) use ($response, $expectedOutput) { - // Create a text representation of the HTTP request - $content = $request->getBody()->__toString(); + $httpClient->method('sendRequest')->willReturnCallback(function ($request) use ($response, $expectedOutput) { + // Create a text representation of the HTTP request + $content = $request->getBody()->__toString(); - $headers = ''; + $headers = ''; - foreach ($request->getHeaders() as $k => $v) { - $headers .= $k . ': ' . $request->getHeaderLine($k) . \PHP_EOL; - } + foreach ($request->getHeaders() as $k => $v) { + $headers .= $k . ': ' . $request->getHeaderLine($k) . \PHP_EOL; + } - $statusLine = sprintf( - '%s %s HTTP/%s', - $request->getMethod(), - $request->getUri()->__toString(), - $request->getProtocolVersion() - ); + $statusLine = sprintf( + '%s %s HTTP/%s', + $request->getMethod(), + $request->getUri()->__toString(), + $request->getProtocolVersion() + ); - $fullRequest = $statusLine . \PHP_EOL . - $headers . \PHP_EOL . - $content - ; + $fullRequest = $statusLine . \PHP_EOL . + $headers . \PHP_EOL . + $content + ; - $this->assertSame($expectedOutput, $fullRequest); + $this->assertSame($expectedOutput, $fullRequest); - return $response; - }) - ); + return $response; + }); $requestFactory = $this->createMock(RequestFactoryInterface::class); - $requestFactory->method('createRequest')->will( - $this->returnCallback(function ($method, $uri) { - return new Request($method, $uri); - }) - ); + $requestFactory->method('createRequest')->willReturnCallback(function ($method, $uri) { + return new Request($method, $uri); + }); $streamFactory = new class () implements StreamFactoryInterface { public function createStream(string $content = ''): StreamInterface From 3134c029ea99ec3e6e523e56d845924db9e3616b Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 14:52:30 +0100 Subject: [PATCH 06/14] Make AssertingHttpClient compatible with PHPUnit 11 --- tests/Fixtures/AssertingHttpClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Fixtures/AssertingHttpClient.php b/tests/Fixtures/AssertingHttpClient.php index 6ba12431..c6fb6ebc 100644 --- a/tests/Fixtures/AssertingHttpClient.php +++ b/tests/Fixtures/AssertingHttpClient.php @@ -4,6 +4,8 @@ namespace Redmine\Tests\Fixtures; +use PHPUnit\Framework\MockObject\MockBuilder; +use PHPUnit\Framework\MockObject\Rule\InvokedCount; use PHPUnit\Framework\TestCase; use Redmine\Http\HttpClient; use Redmine\Http\Request; @@ -21,8 +23,8 @@ public static function create(TestCase $testCase, array $dataSet, ...$dataSets): $dataSets = array_merge([$dataSet], $dataSets); /** @var \PHPUnit\Framework\MockObject\MockObject&HttpClient */ - $mock = $testCase->getMockBuilder(HttpClient::class)->getMock(); - $mock->expects($testCase->exactly(count($dataSets)))->method('request'); + $mock = (new MockBuilder($testCase, HttpClient::class))->getMock(); + $mock->expects(new InvokedCount(count($dataSets)))->method('request'); $client = new self($testCase, $mock); @@ -95,7 +97,7 @@ public function request(Request $request): Response } /** @var \PHPUnit\Framework\MockObject\MockObject&Response */ - $response = $this->testCase->getMockBuilder(Response::class)->getMock(); + $response = (new MockBuilder($this->testCase, Response::class))->getMock(); $response->method('getStatusCode')->willReturn($data['responseCode']); $response->method('getContentType')->willReturn($data['responseContentType']); From 0de348717b5c6cca76c4be0084b9ece135148395 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 14:54:16 +0100 Subject: [PATCH 07/14] Allow tests with PHPUnit 11 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fea2c0eb..cdc487ce 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "guzzlehttp/psr7": "^2", "php-mock/php-mock-phpunit": "^2.6", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9 || ^10.5" + "phpunit/phpunit": "^9.5 || ^10.5 || ^11.0" }, "autoload": { "psr-4": { From 17e87d37513fb82be7f521bddd4e73076b102fa3 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 15:15:21 +0100 Subject: [PATCH 08/14] Replace deprecated PHPUnit method returnValueMap() with willReturnMap() --- .../Client/NativeCurlClient/RequestTest.php | 10 +++-- tests/Unit/Client/NativeCurlClientTest.php | 44 +++++++++---------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/tests/Unit/Client/NativeCurlClient/RequestTest.php b/tests/Unit/Client/NativeCurlClient/RequestTest.php index ccdc05c4..1c01f248 100644 --- a/tests/Unit/Client/NativeCurlClient/RequestTest.php +++ b/tests/Unit/Client/NativeCurlClient/RequestTest.php @@ -37,10 +37,10 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $ $curlSetoptArray = $this->getFunctionMock($namespace, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock($namespace, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, $statusCode], [$curl, CURLINFO_CONTENT_TYPE, $contentType], - ]))); + ])); $curlErrno = $this->getFunctionMock($namespace, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); @@ -52,6 +52,7 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $ 'access_token' ); + /** @var Request|\PHPUnit\Framework\MockObject\MockObject */ $request = $this->createConfiguredMock(Request::class, [ 'getMethod' => $method, 'getPath' => '/path', @@ -109,10 +110,10 @@ public function testRequestWithUploadAndFilepathReturnsCorrectResponse() $curlSetoptArray = $this->getFunctionMock($namespace, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock($namespace, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 201], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlErrno = $this->getFunctionMock($namespace, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); @@ -138,6 +139,7 @@ function ($errno, $errstr): bool { E_USER_DEPRECATED ); + /** @var Request|\PHPUnit\Framework\MockObject\MockObject */ $request = $this->createConfiguredMock(Request::class, [ 'getMethod' => 'POST', 'getPath' => '/uploads.json', diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index ec317453..3b67892a 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -135,10 +135,10 @@ public function testStartAndStopImpersonateUser() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -194,10 +194,10 @@ public function testSetSslVersion() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -254,10 +254,10 @@ public function testSetSslVerifypeer() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -314,10 +314,10 @@ public function testSetSslVerifyhost() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -375,10 +375,10 @@ public function testSetCustomHttpHeaders() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -440,10 +440,10 @@ public function testSetCustomHost() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -501,10 +501,10 @@ public function testSetPort() $curlExec->expects($this->exactly(3))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(6))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(6))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(3)) @@ -560,10 +560,10 @@ public function testCustomPortWillSetFromSchema() $curlExec->expects($this->exactly(1))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(1)) @@ -614,10 +614,10 @@ public function testCustomPortWillSetFromUrl() $curlExec->expects($this->exactly(1))->willReturn(''); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, 200], [$curl, CURLINFO_CONTENT_TYPE, 'application/json'], - ]))); + ])); $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlSetoptArray->expects($this->exactly(1)) @@ -658,10 +658,10 @@ public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $ $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, $statusCode], [$curl, CURLINFO_CONTENT_TYPE, $contentType], - ]))); + ])); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); @@ -726,10 +726,10 @@ public function testHandlingOfResponseWithoutContent() $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - $curlGetinfo->expects($this->exactly(2))->will($this->returnValueMap(([ + $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ [$curl, CURLINFO_HTTP_CODE, $statusCode], [$curl, CURLINFO_CONTENT_TYPE, $contentType], - ]))); + ])); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); From ae3f7518d77273d875f9e384d7041ec84ed68494 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 16:00:09 +0100 Subject: [PATCH 09/14] Add PHPUnit DataProvider Attribute in tests --- tests/Integration/Psr18ClientRequestGenerationTest.php | 2 ++ tests/Unit/Api/AbstractApi/DeleteTest.php | 2 ++ tests/Unit/Api/AbstractApi/GetTest.php | 3 +++ tests/Unit/Api/AbstractApi/PostTest.php | 2 ++ tests/Unit/Api/AbstractApi/PutTest.php | 2 ++ tests/Unit/Api/AbstractApiTest.php | 7 +++++++ tests/Unit/Api/Attachment/DownloadTest.php | 2 ++ tests/Unit/Api/Attachment/ShowTest.php | 2 ++ tests/Unit/Api/Attachment/UploadTest.php | 2 ++ tests/Unit/Api/AttachmentTest.php | 2 ++ tests/Unit/Api/CustomFieldTest.php | 2 ++ tests/Unit/Api/Group/AddUserTest.php | 2 ++ tests/Unit/Api/Group/CreateTest.php | 2 ++ tests/Unit/Api/Group/ShowTest.php | 2 ++ tests/Unit/Api/GroupTest.php | 2 ++ tests/Unit/Api/Issue/AddWatcherTest.php | 2 ++ tests/Unit/Api/Issue/CreateTest.php | 2 ++ tests/Unit/Api/Issue/ShowTest.php | 2 ++ tests/Unit/Api/IssueCategory/CreateTest.php | 3 +++ tests/Unit/Api/IssueCategory/ListByProjectTest.php | 2 ++ tests/Unit/Api/IssueCategory/ShowTest.php | 2 ++ tests/Unit/Api/IssueCategoryTest.php | 2 ++ tests/Unit/Api/IssuePriorityTest.php | 2 ++ tests/Unit/Api/IssueRelation/CreateTest.php | 3 +++ tests/Unit/Api/IssueRelation/ShowTest.php | 2 ++ tests/Unit/Api/IssueRelationTest.php | 2 ++ tests/Unit/Api/IssueStatusTest.php | 2 ++ tests/Unit/Api/IssueTest.php | 3 +++ tests/Unit/Api/Membership/CreateTest.php | 3 +++ tests/Unit/Api/Membership/ListByProjectTest.php | 2 ++ tests/Unit/Api/MembershipTest.php | 2 ++ tests/Unit/Api/News/ListByProjectTest.php | 2 ++ tests/Unit/Api/NewsTest.php | 2 ++ tests/Unit/Api/Project/CreateTest.php | 3 +++ tests/Unit/Api/Project/ShowTest.php | 2 ++ tests/Unit/Api/ProjectTest.php | 2 ++ tests/Unit/Api/QueryTest.php | 2 ++ tests/Unit/Api/Role/ShowTest.php | 2 ++ tests/Unit/Api/RoleTest.php | 2 ++ tests/Unit/Api/Search/SearchTest.php | 2 ++ tests/Unit/Api/TimeEntry/CreateTest.php | 3 +++ tests/Unit/Api/TimeEntry/ShowTest.php | 2 ++ tests/Unit/Api/TimeEntryActivityTest.php | 2 ++ tests/Unit/Api/TimeEntryTest.php | 2 ++ tests/Unit/Api/TrackerTest.php | 2 ++ tests/Unit/Api/User/CreateTest.php | 3 +++ tests/Unit/Api/User/ShowTest.php | 2 ++ tests/Unit/Api/UserTest.php | 2 ++ tests/Unit/Api/Version/CreateTest.php | 2 ++ tests/Unit/Api/Version/ListByProjectTest.php | 2 ++ tests/Unit/Api/Version/ShowTest.php | 2 ++ tests/Unit/Api/VersionTest.php | 6 ++++++ tests/Unit/Api/Wiki/ListByProjectTest.php | 2 ++ tests/Unit/Api/Wiki/ShowTest.php | 2 ++ tests/Unit/Api/WikiTest.php | 2 ++ tests/Unit/Client/NativeCurlClient/RequestTest.php | 2 ++ tests/Unit/Client/NativeCurlClientTest.php | 3 +++ tests/Unit/Client/Psr18Client/RequestTest.php | 2 ++ tests/Unit/Client/Psr18ClientTest.php | 3 +++ tests/Unit/Serializer/JsonSerializerTest.php | 5 +++++ tests/Unit/Serializer/PathSerializerTest.php | 2 ++ tests/Unit/Serializer/XmlSerializerTest.php | 5 +++++ 62 files changed, 149 insertions(+) diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index 9c5cc8ed..261817c9 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -6,6 +6,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Utils; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; @@ -22,6 +23,7 @@ class Psr18ClientRequestGenerationTest extends TestCase * * @dataProvider createdGetRequestsData */ + #[DataProvider('createdGetRequestsData')] public function testPsr18ClientCreatesCorrectRequests( string $url, string $apikeyOrUsername, diff --git a/tests/Unit/Api/AbstractApi/DeleteTest.php b/tests/Unit/Api/AbstractApi/DeleteTest.php index ca38f22f..25ddf103 100644 --- a/tests/Unit/Api/AbstractApi/DeleteTest.php +++ b/tests/Unit/Api/AbstractApi/DeleteTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; use Redmine\Client\Client; @@ -44,6 +45,7 @@ public function testDeleteWithHttpClient() /** * @dataProvider getXmlDecodingFromDeleteMethodData */ + #[DataProvider('getXmlDecodingFromDeleteMethodData')] public function testXmlDecodingFromDeleteMethod($response, $expected) { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/AbstractApi/GetTest.php b/tests/Unit/Api/AbstractApi/GetTest.php index 9a49a7c3..6635c750 100644 --- a/tests/Unit/Api/AbstractApi/GetTest.php +++ b/tests/Unit/Api/AbstractApi/GetTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; use Redmine\Client\Client; @@ -46,6 +47,7 @@ public function testGetWithHttpClient() /** * @dataProvider getJsonDecodingFromGetMethodData */ + #[DataProvider('getJsonDecodingFromGetMethodData')] public function testJsonDecodingFromGetMethod($response, $decode, $expected) { $client = $this->createMock(Client::class); @@ -80,6 +82,7 @@ public static function getJsonDecodingFromGetMethodData(): array /** * @dataProvider getXmlDecodingFromGetMethodData */ + #[DataProvider('getXmlDecodingFromGetMethodData')] public function testXmlDecodingFromGetMethod($response, $decode, $expected) { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/AbstractApi/PostTest.php b/tests/Unit/Api/AbstractApi/PostTest.php index 8facc959..9bc253f9 100644 --- a/tests/Unit/Api/AbstractApi/PostTest.php +++ b/tests/Unit/Api/AbstractApi/PostTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; use Redmine\Client\Client; @@ -46,6 +47,7 @@ public function testPostWithHttpClient() /** * @dataProvider getXmlDecodingFromPostMethodData */ + #[DataProvider('getXmlDecodingFromPostMethodData')] public function testXmlDecodingFromPostMethod($response, $expected) { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/AbstractApi/PutTest.php b/tests/Unit/Api/AbstractApi/PutTest.php index 61656088..8eebc31b 100644 --- a/tests/Unit/Api/AbstractApi/PutTest.php +++ b/tests/Unit/Api/AbstractApi/PutTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; use Redmine\Client\Client; @@ -46,6 +47,7 @@ public function testPutWithHttpClient() /** * @dataProvider getXmlDecodingFromPutMethodData */ + #[DataProvider('getXmlDecodingFromPutMethodData')] public function testXmlDecodingFromPutMethod($response, $expected) { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/AbstractApiTest.php b/tests/Unit/Api/AbstractApiTest.php index 39a473c7..af27e0e8 100644 --- a/tests/Unit/Api/AbstractApiTest.php +++ b/tests/Unit/Api/AbstractApiTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Api; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; use Redmine\Client\Client; @@ -129,6 +130,7 @@ function ($errno, $errstr): bool { * @test * @dataProvider getIsNotNullReturnsCorrectBooleanData */ + #[DataProvider('getIsNotNullReturnsCorrectBooleanData')] public function testIsNotNullReturnsCorrectBoolean(bool $expected, $value) { $client = $this->createMock(Client::class); @@ -214,6 +216,7 @@ public function __construct($client) * @test * @dataProvider getLastCallFailedData */ + #[DataProvider('getLastCallFailedData')] public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $expectedBoolean) { $client = $this->createMock(Client::class); @@ -229,6 +232,7 @@ public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $ * @test * @dataProvider getLastCallFailedData */ + #[DataProvider('getLastCallFailedData')] public function testLastCallFailedWithHttpClientReturnsCorrectBoolean($statusCode, $expectedBoolean) { $response = $this->createMock(Response::class); @@ -324,6 +328,7 @@ public static function getLastCallFailedData(): array * * @dataProvider retrieveDataData */ + #[DataProvider('retrieveDataData')] public function testRetrieveData($response, $contentType, $expected) { $client = $this->createMock(Client::class); @@ -351,6 +356,7 @@ public static function retrieveDataData(): array * * @dataProvider getRetrieveDataToExceptionData */ + #[DataProvider('getRetrieveDataToExceptionData')] public function testRetrieveDataThrowsException($response, $contentType, $expectedException, $expectedMessage) { $client = $this->createMock(Client::class); @@ -381,6 +387,7 @@ public static function getRetrieveDataToExceptionData(): array * * @dataProvider getRetrieveAllData */ + #[DataProvider('getRetrieveAllData')] public function testDeprecatedRetrieveAll($content, $contentType, $expected) { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Attachment/DownloadTest.php b/tests/Unit/Api/Attachment/DownloadTest.php index c0aa4f16..63865912 100644 --- a/tests/Unit/Api/Attachment/DownloadTest.php +++ b/tests/Unit/Api/Attachment/DownloadTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class DownloadTest extends TestCase /** * @dataProvider getDownloadData */ + #[DataProvider('getDownloadData')] public function testDownloadReturnsCorrectResponse($id, $expectedPath, $responseCode, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Attachment/ShowTest.php b/tests/Unit/Api/Attachment/ShowTest.php index 1a14d6a6..a6ee6c8d 100644 --- a/tests/Unit/Api/Attachment/ShowTest.php +++ b/tests/Unit/Api/Attachment/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Attachment/UploadTest.php b/tests/Unit/Api/Attachment/UploadTest.php index f7eabdaf..000b1659 100644 --- a/tests/Unit/Api/Attachment/UploadTest.php +++ b/tests/Unit/Api/Attachment/UploadTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class UploadTest extends TestCase /** * @dataProvider getUploadData */ + #[DataProvider('getUploadData')] public function testUploadReturnsCorrectResponse($attachment, $params, $expectedAttachment, $expectedPath, $responseCode, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index 67171210..380c93d3 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Client\Client; @@ -24,6 +25,7 @@ class AttachmentTest extends TestCase * @param bool $hasFailed * @test */ + #[DataProvider('responseCodeProvider')] public function testLastCallFailedTrue($responseCode, $hasFailed) { // Create the used mock objects diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index 030a4915..79e043f4 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\CustomField; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Group/AddUserTest.php b/tests/Unit/Api/Group/AddUserTest.php index 175c6a05..ae3837ba 100644 --- a/tests/Unit/Api/Group/AddUserTest.php +++ b/tests/Unit/Api/Group/AddUserTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -15,6 +16,7 @@ class AddUserTest extends TestCase /** * @dataProvider getAddUserData */ + #[DataProvider('getAddUserData')] public function testAddUserReturnsCorrectResponse($groupId, $userId, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Group/CreateTest.php b/tests/Unit/Api/Group/CreateTest.php index b99238f4..97333eb2 100644 --- a/tests/Unit/Api/Group/CreateTest.php +++ b/tests/Unit/Api/Group/CreateTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Exception\MissingParameterException; @@ -19,6 +20,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Group/ShowTest.php b/tests/Unit/Api/Group/ShowTest.php index 39559cc9..81a41266 100644 --- a/tests/Unit/Api/Group/ShowTest.php +++ b/tests/Unit/Api/Group/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($groupId, array $params, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/GroupTest.php b/tests/Unit/Api/GroupTest.php index d4acdde6..9e5904d3 100644 --- a/tests/Unit/Api/GroupTest.php +++ b/tests/Unit/Api/GroupTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Client\Client; @@ -49,6 +50,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Issue/AddWatcherTest.php b/tests/Unit/Api/Issue/AddWatcherTest.php index 9e1d6492..f2de8774 100644 --- a/tests/Unit/Api/Issue/AddWatcherTest.php +++ b/tests/Unit/Api/Issue/AddWatcherTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -15,6 +16,7 @@ class AddWatcherTest extends TestCase /** * @dataProvider getAddWatcherData */ + #[DataProvider('getAddWatcherData')] public function testCreateReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Issue/CreateTest.php b/tests/Unit/Api/Issue/CreateTest.php index 1334a8ea..e767394c 100644 --- a/tests/Unit/Api/Issue/CreateTest.php +++ b/tests/Unit/Api/Issue/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -15,6 +16,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Issue/ShowTest.php b/tests/Unit/Api/Issue/ShowTest.php index 1686e49b..7bd78306 100644 --- a/tests/Unit/Api/Issue/ShowTest.php +++ b/tests/Unit/Api/Issue/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($issueId, array $params, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/IssueCategory/CreateTest.php b/tests/Unit/Api/IssueCategory/CreateTest.php index 588c3b5f..270c1303 100644 --- a/tests/Unit/Api/IssueCategory/CreateTest.php +++ b/tests/Unit/Api/IssueCategory/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( @@ -114,6 +116,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/IssueCategory/ListByProjectTest.php b/tests/Unit/Api/IssueCategory/ListByProjectTest.php index 6a40ec13..b3bfafca 100644 --- a/tests/Unit/Api/IssueCategory/ListByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Client\Client; @@ -73,6 +74,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new IssueCategory(MockClient::create()); diff --git a/tests/Unit/Api/IssueCategory/ShowTest.php b/tests/Unit/Api/IssueCategory/ShowTest.php index 7e5acd5f..e46b556d 100644 --- a/tests/Unit/Api/IssueCategory/ShowTest.php +++ b/tests/Unit/Api/IssueCategory/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index 00b854ba..92e891ea 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Client\Client; @@ -48,6 +49,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllDAta * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) { // Test values diff --git a/tests/Unit/Api/IssuePriorityTest.php b/tests/Unit/Api/IssuePriorityTest.php index 08911274..e3d9da99 100644 --- a/tests/Unit/Api/IssuePriorityTest.php +++ b/tests/Unit/Api/IssuePriorityTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssuePriority; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/IssueRelation/CreateTest.php b/tests/Unit/Api/IssueRelation/CreateTest.php index ecbf35a8..60100842 100644 --- a/tests/Unit/Api/IssueRelation/CreateTest.php +++ b/tests/Unit/Api/IssueRelation/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueRelation; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response, $expectedReturn) { $client = AssertingHttpClient::create( @@ -100,6 +102,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/IssueRelation/ShowTest.php b/tests/Unit/Api/IssueRelation/ShowTest.php index 144ac1e2..9b35490b 100644 --- a/tests/Unit/Api/IssueRelation/ShowTest.php +++ b/tests/Unit/Api/IssueRelation/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueRelation; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index ba97896c..8f418cfc 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/IssueStatusTest.php b/tests/Unit/Api/IssueStatusTest.php index 9651565a..76cd4cce 100644 --- a/tests/Unit/Api/IssueStatusTest.php +++ b/tests/Unit/Api/IssueStatusTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueStatus; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/IssueTest.php b/tests/Unit/Api/IssueTest.php index a278d71e..a6189286 100644 --- a/tests/Unit/Api/IssueTest.php +++ b/tests/Unit/Api/IssueTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Client\Client; @@ -34,6 +35,7 @@ public static function getPriorityConstantsData(): array * * @test */ + #[DataProvider('getPriorityConstantsData')] public function testPriorityConstants($expected, $value) { $this->assertSame($expected, $value); @@ -72,6 +74,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Membership/CreateTest.php b/tests/Unit/Api/Membership/CreateTest.php index f736e52c..8e954fa4 100644 --- a/tests/Unit/Api/Membership/CreateTest.php +++ b/tests/Unit/Api/Membership/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Membership; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( @@ -106,6 +108,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/Membership/ListByProjectTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php index 100fd765..f4e3e847 100644 --- a/tests/Unit/Api/Membership/ListByProjectTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Membership; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; use Redmine\Client\Client; @@ -71,6 +72,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new Membership(MockClient::create()); diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index 2e9a22a3..8cdabd4c 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Api; use Exception; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; use Redmine\Client\Client; @@ -49,6 +50,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/News/ListByProjectTest.php b/tests/Unit/Api/News/ListByProjectTest.php index 863196bb..39dee26e 100644 --- a/tests/Unit/Api/News/ListByProjectTest.php +++ b/tests/Unit/Api/News/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\News; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\News; use Redmine\Client\Client; @@ -73,6 +74,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new News(MockClient::create()); diff --git a/tests/Unit/Api/NewsTest.php b/tests/Unit/Api/NewsTest.php index 7fbb4b6c..3dd25b2e 100644 --- a/tests/Unit/Api/NewsTest.php +++ b/tests/Unit/Api/NewsTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\News; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Project/CreateTest.php b/tests/Unit/Api/Project/CreateTest.php index 780ab6f9..7f5cfad8 100644 --- a/tests/Unit/Api/Project/CreateTest.php +++ b/tests/Unit/Api/Project/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Project; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( @@ -172,6 +174,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/Project/ShowTest.php b/tests/Unit/Api/Project/ShowTest.php index 21429ee2..8f906d78 100644 --- a/tests/Unit/Api/Project/ShowTest.php +++ b/tests/Unit/Api/Project/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Project; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($identifier, array $params, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/ProjectTest.php b/tests/Unit/Api/ProjectTest.php index 18d07b6e..eb0ae17b 100644 --- a/tests/Unit/Api/ProjectTest.php +++ b/tests/Unit/Api/ProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Client\Client; @@ -50,6 +51,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/QueryTest.php b/tests/Unit/Api/QueryTest.php index 0b22773e..4380e0ae 100644 --- a/tests/Unit/Api/QueryTest.php +++ b/tests/Unit/Api/QueryTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Query; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Role/ShowTest.php b/tests/Unit/Api/Role/ShowTest.php index af7c24cb..3050c796 100644 --- a/tests/Unit/Api/Role/ShowTest.php +++ b/tests/Unit/Api/Role/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Role; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Role; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/RoleTest.php b/tests/Unit/Api/RoleTest.php index 75f8d6ff..a1bf4b3e 100644 --- a/tests/Unit/Api/RoleTest.php +++ b/tests/Unit/Api/RoleTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Role; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Search/SearchTest.php b/tests/Unit/Api/Search/SearchTest.php index 2eb9126d..c3e78596 100644 --- a/tests/Unit/Api/Search/SearchTest.php +++ b/tests/Unit/Api/Search/SearchTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Search; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Search; use Redmine\Client\Client; @@ -36,6 +37,7 @@ function ($errno, $errstr): bool { /** * @dataProvider getAllData */ + #[DataProvider('getAllData')] public function testSearchReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/TimeEntry/CreateTest.php b/tests/Unit/Api/TimeEntry/CreateTest.php index 753735c1..58456315 100644 --- a/tests/Unit/Api/TimeEntry/CreateTest.php +++ b/tests/Unit/Api/TimeEntry/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\TimeEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( @@ -147,6 +149,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/TimeEntry/ShowTest.php b/tests/Unit/Api/TimeEntry/ShowTest.php index d2f0e1a8..c886916f 100644 --- a/tests/Unit/Api/TimeEntry/ShowTest.php +++ b/tests/Unit/Api/TimeEntry/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\TimeEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/TimeEntryActivityTest.php b/tests/Unit/Api/TimeEntryActivityTest.php index 492e563e..da19e6b6 100644 --- a/tests/Unit/Api/TimeEntryActivityTest.php +++ b/tests/Unit/Api/TimeEntryActivityTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntryActivity; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php index 4f2f25e2..b165119e 100644 --- a/tests/Unit/Api/TimeEntryTest.php +++ b/tests/Unit/Api/TimeEntryTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Client\Client; @@ -48,6 +49,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/TrackerTest.php b/tests/Unit/Api/TrackerTest.php index 35343bf1..771a6b68 100644 --- a/tests/Unit/Api/TrackerTest.php +++ b/tests/Unit/Api/TrackerTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Tracker; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/User/CreateTest.php b/tests/Unit/Api/User/CreateTest.php index 0bd6be32..600e90ce 100644 --- a/tests/Unit/Api/User/CreateTest.php +++ b/tests/Unit/Api/User/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\User; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; use Redmine\Exception\MissingParameterException; @@ -17,6 +18,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( @@ -134,6 +136,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() /** * @dataProvider incompleteCreateParameterProvider */ + #[DataProvider('incompleteCreateParameterProvider')] public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters) { // Create the used mock objects diff --git a/tests/Unit/Api/User/ShowTest.php b/tests/Unit/Api/User/ShowTest.php index 57cdc60f..95d0cb8c 100644 --- a/tests/Unit/Api/User/ShowTest.php +++ b/tests/Unit/Api/User/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\User; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($userId, array $params, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/UserTest.php b/tests/Unit/Api/UserTest.php index 12f60e6d..0417783b 100644 --- a/tests/Unit/Api/UserTest.php +++ b/tests/Unit/Api/UserTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; use Redmine\Client\Client; @@ -121,6 +122,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Api/Version/CreateTest.php b/tests/Unit/Api/Version/CreateTest.php index 4531710c..5db33426 100644 --- a/tests/Unit/Api/Version/CreateTest.php +++ b/tests/Unit/Api/Version/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; use Redmine\Exception\InvalidParameterException; @@ -18,6 +19,7 @@ class CreateTest extends TestCase /** * @dataProvider getCreateData */ + #[DataProvider('getCreateData')] public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/Version/ListByProjectTest.php b/tests/Unit/Api/Version/ListByProjectTest.php index a9fca8d5..53f25d40 100644 --- a/tests/Unit/Api/Version/ListByProjectTest.php +++ b/tests/Unit/Api/Version/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; use Redmine\Client\Client; @@ -74,6 +75,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new Version(MockClient::create()); diff --git a/tests/Unit/Api/Version/ShowTest.php b/tests/Unit/Api/Version/ShowTest.php index 1e3cbade..884d99c6 100644 --- a/tests/Unit/Api/Version/ShowTest.php +++ b/tests/Unit/Api/Version/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($version, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/VersionTest.php b/tests/Unit/Api/VersionTest.php index cc276b9f..7a5178c9 100644 --- a/tests/Unit/Api/VersionTest.php +++ b/tests/Unit/Api/VersionTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; use Redmine\Client\Client; @@ -48,6 +49,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects @@ -476,6 +478,7 @@ public function testGetIdByNameMakesGetRequest() * * @param string $sharingValue */ + #[DataProvider('invalidSharingProvider')] public function testCreateThrowsExceptionWithInvalidSharing($sharingValue) { // Test values @@ -508,6 +511,7 @@ public function testCreateThrowsExceptionWithInvalidSharing($sharingValue) * @param string $sharingValue * @param string $sharingXmlElement */ + #[DataProvider('validSharingProvider')] public function testUpdateWithValidSharing($sharingValue, $sharingXmlElement) { // Test values @@ -552,6 +556,7 @@ public function testUpdateWithValidSharing($sharingValue, $sharingXmlElement) * * @param string $sharingValue */ + #[DataProvider('validEmptySharingProvider')] public function testUpdateWithValidEmptySharing($sharingValue) { // Test values @@ -599,6 +604,7 @@ public function testUpdateWithValidEmptySharing($sharingValue) * * @param string $sharingValue */ + #[DataProvider('invalidSharingProvider')] public function testUpdateThrowsExceptionWithInvalidSharing($sharingValue) { // Test values diff --git a/tests/Unit/Api/Wiki/ListByProjectTest.php b/tests/Unit/Api/Wiki/ListByProjectTest.php index 1a336e5e..4d88fd30 100644 --- a/tests/Unit/Api/Wiki/ListByProjectTest.php +++ b/tests/Unit/Api/Wiki/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Wiki; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; use Redmine\Client\Client; @@ -74,6 +75,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new Wiki(MockClient::create()); diff --git a/tests/Unit/Api/Wiki/ShowTest.php b/tests/Unit/Api/Wiki/ShowTest.php index 07bff14c..9300ab4a 100644 --- a/tests/Unit/Api/Wiki/ShowTest.php +++ b/tests/Unit/Api/Wiki/ShowTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Wiki; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; use Redmine\Tests\Fixtures\AssertingHttpClient; @@ -14,6 +15,7 @@ class ShowTest extends TestCase /** * @dataProvider getShowData */ + #[DataProvider('getShowData')] public function testShowReturnsCorrectResponse($identifier, $page, $version, $expectedPath, $response, $expectedReturn) { $client = AssertingHttpClient::create( diff --git a/tests/Unit/Api/WikiTest.php b/tests/Unit/Api/WikiTest.php index ace37136..4fc98df3 100644 --- a/tests/Unit/Api/WikiTest.php +++ b/tests/Unit/Api/WikiTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; use Redmine\Client\Client; @@ -47,6 +48,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData * @test */ + #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) { // Create the used mock objects diff --git a/tests/Unit/Client/NativeCurlClient/RequestTest.php b/tests/Unit/Client/NativeCurlClient/RequestTest.php index 1c01f248..936d0a86 100644 --- a/tests/Unit/Client/NativeCurlClient/RequestTest.php +++ b/tests/Unit/Client/NativeCurlClient/RequestTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Client\NativeCurlClientTest; use phpmock\phpunit\PHPMock; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Client\NativeCurlClient; use Redmine\Http\Request; @@ -22,6 +23,7 @@ class RequestTest extends TestCase /** * @dataProvider getRequestReponseData */ + #[DataProvider('getRequestReponseData')] public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content) { $namespace = 'Redmine\Client'; diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 3b67892a..5c5cf018 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; use phpmock\phpunit\PHPMock; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Client\Client; use Redmine\Client\NativeCurlClient; @@ -645,6 +646,7 @@ public function testCustomPortWillSetFromUrl() * @test * @dataProvider getRequestReponseData */ + #[DataProvider('getRequestReponseData')] public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content) { $curl = $this->createMock(stdClass::class); @@ -790,6 +792,7 @@ public function testCurlErrorThrowsException() * @param string $class * @dataProvider getApiClassesProvider */ + #[DataProvider('getApiClassesProvider')] public function getApiShouldReturnApiInstance($apiName, $class) { $client = new NativeCurlClient( diff --git a/tests/Unit/Client/Psr18Client/RequestTest.php b/tests/Unit/Client/Psr18Client/RequestTest.php index 3230c888..92669f05 100644 --- a/tests/Unit/Client/Psr18Client/RequestTest.php +++ b/tests/Unit/Client/Psr18Client/RequestTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Client\Psr18ClientTest; use Exception; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; @@ -26,6 +27,7 @@ class RequestTest extends TestCase /** * @dataProvider getRequestReponseData */ + #[DataProvider('getRequestReponseData')] public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content) { $httpClient = $this->createConfiguredMock(ClientInterface::class, [ diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index 5859e540..b61beac6 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -4,6 +4,7 @@ use Exception; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; @@ -204,6 +205,7 @@ public function testRequestGetReturnsFalse() * @test * @dataProvider getRequestReponseData */ + #[DataProvider('getRequestReponseData')] public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content) { $stream = $this->createMock(StreamInterface::class); @@ -272,6 +274,7 @@ public static function getRequestReponseData(): array * @param string $class * @dataProvider getApiClassesProvider */ + #[DataProvider('getApiClassesProvider')] public function getApiShouldReturnApiInstance($apiName, $class) { $client = new Psr18Client( diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index afed796d..8814a036 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Exception\SerializerException; use Redmine\Serializer\JsonSerializer; @@ -64,6 +65,7 @@ public static function getEncodedToNormalizedData(): array * * @dataProvider getEncodedToNormalizedData */ + #[DataProvider('getEncodedToNormalizedData')] public function createFromStringDecodesToExpectedNormalizedData(string $data, $expected) { $serializer = JsonSerializer::createFromString($data); @@ -90,6 +92,7 @@ public static function getInvalidEncodedData(): array * * @dataProvider getInvalidEncodedData */ + #[DataProvider('getInvalidEncodedData')] public function createFromStringWithInvalidStringThrowsException(string $message, string $data) { $this->expectException(SerializerException::class); @@ -187,6 +190,7 @@ public static function getNormalizedToEncodedData(): array * * @dataProvider getNormalizedToEncodedData */ + #[DataProvider('getNormalizedToEncodedData')] public function createFromArrayEncodesToExpectedString(array $data, $expected) { $serializer = JsonSerializer::createFromArray($data); @@ -209,6 +213,7 @@ public static function getInvalidSerializedData(): array * * @dataProvider getInvalidSerializedData */ + #[DataProvider('getInvalidSerializedData')] public function createFromArrayWithInvalidDataThrowsException(string $message, array $data) { $this->expectException(SerializerException::class); diff --git a/tests/Unit/Serializer/PathSerializerTest.php b/tests/Unit/Serializer/PathSerializerTest.php index 35a8499a..a88b2a64 100644 --- a/tests/Unit/Serializer/PathSerializerTest.php +++ b/tests/Unit/Serializer/PathSerializerTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Serializer\PathSerializer; @@ -55,6 +56,7 @@ public static function getPathData(): array * * @dataProvider getPathData */ + #[DataProvider('getPathData')] public function getPathShouldReturnExpectedString(string $path, array $params, string $expected) { $serializer = PathSerializer::create($path, $params); diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index 170e456c..ff820eb9 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Exception\SerializerException; use Redmine\Serializer\XmlSerializer; @@ -67,6 +68,7 @@ public static function getEncodedToNormalizedData(): array * * @dataProvider getEncodedToNormalizedData */ + #[DataProvider('getEncodedToNormalizedData')] public function createFromStringDecodesToExpectedNormalizedData(string $data, $expected) { $serializer = XmlSerializer::createFromString($data); @@ -105,6 +107,7 @@ public static function getInvalidEncodedData(): array * * @dataProvider getInvalidEncodedData */ + #[DataProvider('getInvalidEncodedData')] public function createFromStringWithInvalidStringThrowsException(string $message, string $data) { $this->expectException(SerializerException::class); @@ -257,6 +260,7 @@ public static function getNormalizedToEncodedData(): array * * @dataProvider getNormalizedToEncodedData */ + #[DataProvider('getNormalizedToEncodedData')] public function createFromArrayEncodesToExpectedString(array $data, $expected) { $serializer = XmlSerializer::createFromArray($data); @@ -279,6 +283,7 @@ public static function getInvalidSerializedData(): array * * @dataProvider getInvalidSerializedData */ + #[DataProvider('getInvalidSerializedData')] public function createFromArrayWithInvalidDataThrowsException(string $message, array $data) { $this->expectException(SerializerException::class); From 63509c604133bc3c65b40d260d5edd981b512a24 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 16:28:30 +0100 Subject: [PATCH 10/14] Remove deprecated test-tag for tests --- .../Psr18ClientRequestGenerationTest.php | 2 +- tests/Unit/Api/AbstractApiTest.php | 3 - tests/Unit/Api/AttachmentTest.php | 1 - tests/Unit/Api/CustomFieldTest.php | 8 --- tests/Unit/Api/GroupTest.php | 7 -- tests/Unit/Api/IssueCategoryTest.php | 9 --- tests/Unit/Api/IssuePriorityTest.php | 2 - tests/Unit/Api/IssueRelationTest.php | 3 - tests/Unit/Api/IssueStatusTest.php | 6 -- tests/Unit/Api/IssueTest.php | 15 ----- tests/Unit/Api/MembershipTest.php | 8 --- tests/Unit/Api/NewsTest.php | 3 - tests/Unit/Api/ProjectTest.php | 8 --- tests/Unit/Api/QueryTest.php | 2 - tests/Unit/Api/RoleTest.php | 5 -- tests/Unit/Api/TimeEntryActivityTest.php | 2 - tests/Unit/Api/TimeEntryTest.php | 4 -- tests/Unit/Api/TrackerTest.php | 6 -- tests/Unit/Api/UserTest.php | 10 --- tests/Unit/Api/VersionTest.php | 16 ----- tests/Unit/Api/WikiTest.php | 7 -- tests/Unit/Client/NativeCurlClientTest.php | 27 ++------ tests/Unit/Client/Psr18ClientTest.php | 18 ++---- .../InvalidParameterExceptionTest.php | 3 - .../MissingParameterExceptionTest.php | 3 - tests/Unit/Serializer/JsonSerializerTest.php | 16 ++--- tests/Unit/Serializer/PathSerializerTest.php | 4 +- tests/Unit/Serializer/XmlSerializerTest.php | 64 ++++++++----------- 28 files changed, 42 insertions(+), 220 deletions(-) diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index 261817c9..faf50b7c 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -19,7 +19,6 @@ class Psr18ClientRequestGenerationTest extends TestCase { /** * @covers \Redmine\Client\Psr18Client - * @test * * @dataProvider createdGetRequestsData */ @@ -36,6 +35,7 @@ public function testPsr18ClientCreatesCorrectRequests( ) { $response = $this->createMock(ResponseInterface::class); + /** @var ClientInterface|\PHPUnit\Framework\MockObject\MockObject */ $httpClient = $this->createMock(ClientInterface::class); $httpClient->method('sendRequest')->willReturnCallback(function ($request) use ($response, $expectedOutput) { // Create a text representation of the HTTP request diff --git a/tests/Unit/Api/AbstractApiTest.php b/tests/Unit/Api/AbstractApiTest.php index af27e0e8..b5da425e 100644 --- a/tests/Unit/Api/AbstractApiTest.php +++ b/tests/Unit/Api/AbstractApiTest.php @@ -127,7 +127,6 @@ function ($errno, $errstr): bool { } /** - * @test * @dataProvider getIsNotNullReturnsCorrectBooleanData */ #[DataProvider('getIsNotNullReturnsCorrectBooleanData')] @@ -213,7 +212,6 @@ public function __construct($client) /** * @covers ::lastCallFailed - * @test * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] @@ -229,7 +227,6 @@ public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $ /** * @covers ::lastCallFailed - * @test * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index 380c93d3..88e2f291 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -23,7 +23,6 @@ class AttachmentTest extends TestCase * * @param int $responseCode * @param bool $hasFailed - * @test */ #[DataProvider('responseCodeProvider')] public function testLastCallFailedTrue($responseCode, $hasFailed) diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index 79e043f4..312bcd68 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -119,7 +117,6 @@ public function testAllReturnsClientGetResponseWithParameters() * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithHighLimit() { @@ -157,7 +154,6 @@ public function testAllReturnsClientGetResponseWithHighLimit() * Test all(). * * @covers ::all - * @test */ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() { @@ -200,7 +196,6 @@ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -237,7 +232,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -275,7 +269,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -313,7 +306,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/GroupTest.php b/tests/Unit/Api/GroupTest.php index 9e5904d3..85caac8d 100644 --- a/tests/Unit/Api/GroupTest.php +++ b/tests/Unit/Api/GroupTest.php @@ -48,7 +48,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -86,7 +85,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -124,7 +122,6 @@ public function testAllReturnsClientGetResponseWithParameters() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -161,7 +158,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -199,7 +195,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -238,7 +233,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -279,7 +273,6 @@ public function testRemoveCallsDelete() * * @covers ::delete * @covers ::removeUser - * @test */ public function testRemoveUserCallsDelete() { diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index 92e891ea..f01cc9b9 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -47,7 +47,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllDAta - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) @@ -88,7 +87,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -127,7 +125,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -164,7 +161,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -202,7 +198,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -241,7 +236,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -275,7 +269,6 @@ public function testRemoveCallsDelete() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDeleteWithParameters() { @@ -313,7 +306,6 @@ public function testRemoveCallsDeleteWithParameters() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { @@ -348,7 +340,6 @@ public function testGetIdByNameMakesGetRequest() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/IssuePriorityTest.php b/tests/Unit/Api/IssuePriorityTest.php index e3d9da99..fe35eb97 100644 --- a/tests/Unit/Api/IssuePriorityTest.php +++ b/tests/Unit/Api/IssuePriorityTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index 8f418cfc..ad21102e 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -123,7 +121,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { diff --git a/tests/Unit/Api/IssueStatusTest.php b/tests/Unit/Api/IssueStatusTest.php index 76cd4cce..e865ff5e 100644 --- a/tests/Unit/Api/IssueStatusTest.php +++ b/tests/Unit/Api/IssueStatusTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -122,7 +120,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -159,7 +156,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -197,7 +193,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -235,7 +230,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/IssueTest.php b/tests/Unit/Api/IssueTest.php index a6189286..470158d2 100644 --- a/tests/Unit/Api/IssueTest.php +++ b/tests/Unit/Api/IssueTest.php @@ -32,8 +32,6 @@ public static function getPriorityConstantsData(): array * Test the constants. * * @dataProvider getPriorityConstantsData - * - * @test */ #[DataProvider('getPriorityConstantsData')] public function testPriorityConstants($expected, $value) @@ -72,7 +70,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -110,7 +107,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -149,7 +145,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -186,7 +181,6 @@ public function testRemoveCallsDelete() * * @covers ::attach * @covers ::put - * @test */ public function testAttachCallsPut() { @@ -233,7 +227,6 @@ public function testAttachCallsPut() * Test removeWatcher(). * * @covers ::removeWatcher - * @test */ public function testRemoveWatcherCallsPost() { @@ -269,7 +262,6 @@ public function testRemoveWatcherCallsPost() * @covers ::getProjectApi * @covers ::getTrackerApi * @covers ::getUserApi - * @test */ public function testCreateWithClientCleansParameters() { @@ -346,7 +338,6 @@ public function testCreateWithClientCleansParameters() * * @covers ::update * @covers ::put - * @test */ public function testUpdateCallsPut() { @@ -379,7 +370,6 @@ public function testUpdateCallsPut() * * @covers ::update * @covers ::cleanParams - * @test */ public function testUpdateCleansParameters() { @@ -453,7 +443,6 @@ public function testUpdateCleansParameters() * Test setIssueStatus(). * * @covers ::setIssueStatus - * @test */ public function testSetIssueStatusWithClient() { @@ -499,7 +488,6 @@ public function testSetIssueStatusWithClient() * Test setIssueStatus(). * * @covers ::setIssueStatus - * @test */ public function testSetIssueStatusWithHttpClient() { @@ -542,7 +530,6 @@ public function testSetIssueStatusWithHttpClient() * Test addNoteToIssue(). * * @covers ::addNoteToIssue - * @test */ public function testAddNoteToIssue() { @@ -577,7 +564,6 @@ public function testAddNoteToIssue() /** * Test assign an user to an issue. * - * @test */ public function testAssignUserToAnIssue() { @@ -609,7 +595,6 @@ public function testAssignUserToAnIssue() /** * Test unassign an user from an issue. * - * @test */ public function testUnassignUserFromAnIssue() { diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index 8cdabd4c..41b55464 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -48,7 +48,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) @@ -86,7 +85,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -125,7 +123,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -161,7 +158,6 @@ public function testRemoveCallsDelete() * Test removeMember(). * * @covers ::removeMember - * @test */ public function testRemoveMemberCallsDelete() { @@ -208,7 +204,6 @@ public function testRemoveMemberCallsDelete() * Test removeMember(). * * @covers ::removeMember - * @test */ public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() { @@ -236,7 +231,6 @@ public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() * Test removeMember(). * * @covers ::removeMember - * @test */ public function testRemoveMemberReturnsFalseIfMemberlistIsMissing() { @@ -265,7 +259,6 @@ public function testRemoveMemberReturnsFalseIfMemberlistIsMissing() * * @covers ::update * - * @test */ public function testUpdateThrowsExceptionIfRoleIdsAreMissingInParameters() { @@ -290,7 +283,6 @@ public function testUpdateThrowsExceptionIfRoleIdsAreMissingInParameters() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/NewsTest.php b/tests/Unit/Api/NewsTest.php index 3dd25b2e..3f8f9dda 100644 --- a/tests/Unit/Api/NewsTest.php +++ b/tests/Unit/Api/NewsTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithProject() { @@ -119,7 +117,6 @@ public function testAllReturnsClientGetResponseWithProject() * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { diff --git a/tests/Unit/Api/ProjectTest.php b/tests/Unit/Api/ProjectTest.php index eb0ae17b..52e8d090 100644 --- a/tests/Unit/Api/ProjectTest.php +++ b/tests/Unit/Api/ProjectTest.php @@ -49,7 +49,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -87,7 +86,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -126,7 +124,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -154,7 +151,6 @@ public function testRemoveCallsDelete() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -191,7 +187,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -229,7 +224,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -267,7 +261,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { @@ -302,7 +295,6 @@ public function testGetIdByNameMakesGetRequest() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/QueryTest.php b/tests/Unit/Api/QueryTest.php index 4380e0ae..2ebfb09f 100644 --- a/tests/Unit/Api/QueryTest.php +++ b/tests/Unit/Api/QueryTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/RoleTest.php b/tests/Unit/Api/RoleTest.php index a1bf4b3e..479020d9 100644 --- a/tests/Unit/Api/RoleTest.php +++ b/tests/Unit/Api/RoleTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -122,7 +120,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -159,7 +156,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -197,7 +193,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { diff --git a/tests/Unit/Api/TimeEntryActivityTest.php b/tests/Unit/Api/TimeEntryActivityTest.php index da19e6b6..374255c0 100644 --- a/tests/Unit/Api/TimeEntryActivityTest.php +++ b/tests/Unit/Api/TimeEntryActivityTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php index b165119e..50cce4fa 100644 --- a/tests/Unit/Api/TimeEntryTest.php +++ b/tests/Unit/Api/TimeEntryTest.php @@ -47,7 +47,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -85,7 +84,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -130,7 +128,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -159,7 +156,6 @@ public function testRemoveCallsDelete() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/TrackerTest.php b/tests/Unit/Api/TrackerTest.php index 771a6b68..76590f8b 100644 --- a/tests/Unit/Api/TrackerTest.php +++ b/tests/Unit/Api/TrackerTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -122,7 +120,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -159,7 +156,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -197,7 +193,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -235,7 +230,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/UserTest.php b/tests/Unit/Api/UserTest.php index 0417783b..02d9fc37 100644 --- a/tests/Unit/Api/UserTest.php +++ b/tests/Unit/Api/UserTest.php @@ -19,7 +19,6 @@ class UserTest extends TestCase * Test getCurrentUser(). * * @covers ::getCurrentUser - * @test */ public function testGetCurrentUserReturnsClientGetResponse() { @@ -56,7 +55,6 @@ public function testGetCurrentUserReturnsClientGetResponse() * Test getIdByUsername(). * * @covers ::getIdByUsername - * @test */ public function testGetIdByUsernameMakesGetRequest() { @@ -120,7 +118,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -158,7 +155,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -201,7 +197,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -230,7 +225,6 @@ public function testRemoveCallsDelete() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { @@ -270,7 +264,6 @@ public function testUpdateCallsPut() * @covers ::put * @covers ::update * @covers ::attachCustomFieldXML - * @test */ public function testUpdateWithCustomField() { @@ -317,7 +310,6 @@ public function testUpdateWithCustomField() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -354,7 +346,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -392,7 +383,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { diff --git a/tests/Unit/Api/VersionTest.php b/tests/Unit/Api/VersionTest.php index 7a5178c9..0d0f4cd5 100644 --- a/tests/Unit/Api/VersionTest.php +++ b/tests/Unit/Api/VersionTest.php @@ -47,7 +47,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -85,7 +84,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -128,7 +126,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveWithNumericIdCallsDelete() { @@ -157,7 +154,6 @@ public function testRemoveWithNumericIdCallsDelete() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveWithStringCallsDelete() { @@ -187,7 +183,6 @@ public function testRemoveWithStringCallsDelete() * @covers ::update * @covers ::validateStatus * - * @test */ public function testUpdateThrowsExceptionWithInvalidStatus() { @@ -215,7 +210,6 @@ public function testUpdateThrowsExceptionWithInvalidStatus() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { @@ -255,7 +249,6 @@ public function testUpdateCallsPut() * @covers ::update * @covers ::put * @covers ::validateStatus - * @test */ public function testUpdateWithValidStatusCallsPut() { @@ -295,7 +288,6 @@ public function testUpdateWithValidStatusCallsPut() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsNameIdArray() { @@ -330,7 +322,6 @@ public function testListingReturnsNameIdArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingReturnsIdNameIfReverseIsFalseArray() { @@ -365,7 +356,6 @@ public function testListingReturnsIdNameIfReverseIsFalseArray() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetOnlyTheFirstTime() { @@ -401,7 +391,6 @@ public function testListingCallsGetOnlyTheFirstTime() * Test listing(). * * @covers ::listing - * @test */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -437,7 +426,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() * Test getIdByName(). * * @covers ::getIdByName - * @test */ public function testGetIdByNameMakesGetRequest() { @@ -474,7 +462,6 @@ public function testGetIdByNameMakesGetRequest() * @covers ::validateSharing * @dataProvider invalidSharingProvider * - * @test * * @param string $sharingValue */ @@ -506,7 +493,6 @@ public function testCreateThrowsExceptionWithInvalidSharing($sharingValue) * @covers ::update * @covers ::validateSharing * @dataProvider validSharingProvider - * @test * * @param string $sharingValue * @param string $sharingXmlElement @@ -552,7 +538,6 @@ public function testUpdateWithValidSharing($sharingValue, $sharingXmlElement) * @covers ::update * @covers ::validateSharing * @dataProvider validEmptySharingProvider - * @test * * @param string $sharingValue */ @@ -600,7 +585,6 @@ public function testUpdateWithValidEmptySharing($sharingValue) * @covers ::validateSharing * @dataProvider invalidSharingProvider * - * @test * * @param string $sharingValue */ diff --git a/tests/Unit/Api/WikiTest.php b/tests/Unit/Api/WikiTest.php index 4fc98df3..51a3a33a 100644 --- a/tests/Unit/Api/WikiTest.php +++ b/tests/Unit/Api/WikiTest.php @@ -46,7 +46,6 @@ function ($errno, $errstr): bool { * * @covers ::all * @dataProvider getAllData - * @test */ #[DataProvider('getAllData')] public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) @@ -84,7 +83,6 @@ public static function getAllData(): array * Test all(). * * @covers ::all - * @test */ public function testAllReturnsClientGetResponseWithParameters() { @@ -127,7 +125,6 @@ public function testAllReturnsClientGetResponseWithParameters() * * @covers ::delete * @covers ::remove - * @test */ public function testRemoveCallsDelete() { @@ -156,7 +153,6 @@ public function testRemoveCallsDelete() * * @covers ::create * @covers ::post - * @test */ public function testCreateCallsPost() { @@ -188,7 +184,6 @@ public function testCreateCallsPost() * * @covers ::create * @covers ::post - * @test */ public function testCreateWithParametersCallsPost() { @@ -231,7 +226,6 @@ public function testCreateWithParametersCallsPost() * * @covers ::put * @covers ::update - * @test */ public function testUpdateCallsPut() { @@ -263,7 +257,6 @@ public function testUpdateCallsPut() * * @covers ::put * @covers ::update - * @test */ public function testUpdateWithParametersCallsPut() { diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 5c5cf018..4438c847 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -35,9 +35,8 @@ class NativeCurlClientTest extends TestCase /** * @covers \Redmine\Client\NativeCurlClient - * @test */ - public function shouldPassApiKeyToConstructor() + public function testApiKeyShouldBePassToConstructor() { $client = new NativeCurlClient( 'http://test.local', @@ -51,9 +50,8 @@ public function shouldPassApiKeyToConstructor() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ - public function shouldPassUsernameAndPasswordToConstructor() + public function testShouldPassUsernameAndPasswordToConstructor() { $client = new NativeCurlClient( 'http://test.local', @@ -67,7 +65,6 @@ public function shouldPassUsernameAndPasswordToConstructor() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testGetLastResponseStatusCodeIsInitialNull() { @@ -81,7 +78,6 @@ public function testGetLastResponseStatusCodeIsInitialNull() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testGetLastResponseContentTypeIsInitialEmpty() { @@ -95,7 +91,6 @@ public function testGetLastResponseContentTypeIsInitialEmpty() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testGetLastResponseBodyIsInitialEmpty() { @@ -109,7 +104,6 @@ public function testGetLastResponseBodyIsInitialEmpty() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testStartAndStopImpersonateUser() { @@ -169,7 +163,6 @@ public function testStartAndStopImpersonateUser() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetSslVersion() { @@ -228,7 +221,6 @@ public function testSetSslVersion() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetSslVerifypeer() { @@ -288,7 +280,6 @@ public function testSetSslVerifypeer() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetSslVerifyhost() { @@ -348,7 +339,6 @@ public function testSetSslVerifyhost() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetCustomHttpHeaders() { @@ -414,7 +404,6 @@ public function testSetCustomHttpHeaders() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetCustomHost() { @@ -476,7 +465,6 @@ public function testSetCustomHost() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testSetPort() { @@ -535,7 +523,6 @@ public function testSetPort() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testCustomPortWillSetFromSchema() { @@ -589,7 +576,6 @@ public function testCustomPortWillSetFromSchema() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testCustomPortWillSetFromUrl() { @@ -643,7 +629,6 @@ public function testCustomPortWillSetFromUrl() /** * @covers \Redmine\Client\NativeCurlClient - * @test * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] @@ -709,7 +694,6 @@ public static function getRequestReponseData(): array /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testHandlingOfResponseWithoutContent() { @@ -751,7 +735,6 @@ public function testHandlingOfResponseWithoutContent() /** * @covers \Redmine\Client\NativeCurlClient - * @test */ public function testCurlErrorThrowsException() { @@ -786,14 +769,13 @@ public function testCurlErrorThrowsException() /** * @covers \Redmine\Client\NativeCurlClient - * @test * * @param string $apiName * @param string $class * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function getApiShouldReturnApiInstance($apiName, $class) + public function testGetApiShouldReturnApiInstance($apiName, $class) { $client = new NativeCurlClient( 'http://test.local', @@ -830,9 +812,8 @@ public static function getApiClassesProvider(): array /** * @covers \Redmine\Client\NativeCurlClient - * @test */ - public function getApiShouldThrowException() + public function testGetApiShouldThrowException() { $client = new NativeCurlClient( 'http://test.local', diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index b61beac6..625ed56d 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -23,9 +23,8 @@ class Psr18ClientTest extends TestCase { /** * @covers \Redmine\Client\Psr18Client - * @test */ - public function shouldPassApiKeyToConstructor() + public function testShouldPassApiKeyToConstructor() { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -69,9 +68,8 @@ public function testServerRequestFactoryIsAcceptedInConstructorForBC() /** * @covers \Redmine\Client\Psr18Client - * @test */ - public function shouldPassUsernameAndPasswordToConstructor() + public function testShouldPassUsernameAndPasswordToConstructor() { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -88,7 +86,6 @@ public function shouldPassUsernameAndPasswordToConstructor() /** * @covers \Redmine\Client\Psr18Client - * @test */ public function testGetLastResponseStatusCodeIsInitialZero() { @@ -105,7 +102,6 @@ public function testGetLastResponseStatusCodeIsInitialZero() /** * @covers \Redmine\Client\Psr18Client - * @test */ public function testGetLastResponseContentTypeIsInitialEmpty() { @@ -122,7 +118,6 @@ public function testGetLastResponseContentTypeIsInitialEmpty() /** * @covers \Redmine\Client\Psr18Client - * @test */ public function testGetLastResponseBodyIsInitialEmpty() { @@ -139,7 +134,6 @@ public function testGetLastResponseBodyIsInitialEmpty() /** * @covers \Redmine\Client\Psr18Client - * @test */ public function testStartAndStopImpersonateUser() { @@ -173,7 +167,6 @@ public function testStartAndStopImpersonateUser() /** * @covers \Redmine\Client\Psr18Client - * @test */ public function testRequestGetReturnsFalse() { @@ -202,7 +195,6 @@ public function testRequestGetReturnsFalse() /** * @covers \Redmine\Client\Psr18Client - * @test * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] @@ -268,14 +260,13 @@ public static function getRequestReponseData(): array /** * @covers \Redmine\Client\Psr18Client - * @test * * @param string $apiName * @param string $class * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function getApiShouldReturnApiInstance($apiName, $class) + public function testGetApiShouldReturnApiInstance($apiName, $class) { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -333,9 +324,8 @@ public function testCreateWithoutFactoryThrowsException() /** * @covers \Redmine\Client\Psr18Client - * @test */ - public function getApiShouldThrowException() + public function testGetApiShouldThrowException() { $client = new Psr18Client( $this->createMock(ClientInterface::class), diff --git a/tests/Unit/Exception/InvalidParameterExceptionTest.php b/tests/Unit/Exception/InvalidParameterExceptionTest.php index 0324d9f4..f0b9eb6d 100644 --- a/tests/Unit/Exception/InvalidParameterExceptionTest.php +++ b/tests/Unit/Exception/InvalidParameterExceptionTest.php @@ -10,9 +10,6 @@ class InvalidParameterExceptionTest extends TestCase { - /** - * @test - */ public function testInvalidParameterException() { $exception = new InvalidParameterException(); diff --git a/tests/Unit/Exception/MissingParameterExceptionTest.php b/tests/Unit/Exception/MissingParameterExceptionTest.php index 31b00c0e..7fdae1dd 100644 --- a/tests/Unit/Exception/MissingParameterExceptionTest.php +++ b/tests/Unit/Exception/MissingParameterExceptionTest.php @@ -10,9 +10,6 @@ class MissingParameterExceptionTest extends TestCase { - /** - * @test - */ public function testMissingParameterException() { $exception = new MissingParameterException(); diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 8814a036..65db3f8e 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -61,12 +61,10 @@ public static function getEncodedToNormalizedData(): array } /** - * @test - * * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function createFromStringDecodesToExpectedNormalizedData(string $data, $expected) + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected) { $serializer = JsonSerializer::createFromString($data); @@ -88,12 +86,10 @@ public static function getInvalidEncodedData(): array } /** - * @test - * * @dataProvider getInvalidEncodedData */ #[DataProvider('getInvalidEncodedData')] - public function createFromStringWithInvalidStringThrowsException(string $message, string $data) + public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data) { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); @@ -186,12 +182,10 @@ public static function getNormalizedToEncodedData(): array } /** - * @test - * * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function createFromArrayEncodesToExpectedString(array $data, $expected) + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected) { $serializer = JsonSerializer::createFromArray($data); @@ -209,12 +203,10 @@ public static function getInvalidSerializedData(): array } /** - * @test - * * @dataProvider getInvalidSerializedData */ #[DataProvider('getInvalidSerializedData')] - public function createFromArrayWithInvalidDataThrowsException(string $message, array $data) + public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data) { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); diff --git a/tests/Unit/Serializer/PathSerializerTest.php b/tests/Unit/Serializer/PathSerializerTest.php index a88b2a64..17a9c2d3 100644 --- a/tests/Unit/Serializer/PathSerializerTest.php +++ b/tests/Unit/Serializer/PathSerializerTest.php @@ -52,12 +52,10 @@ public static function getPathData(): array } /** - * @test - * * @dataProvider getPathData */ #[DataProvider('getPathData')] - public function getPathShouldReturnExpectedString(string $path, array $params, string $expected) + public function testGetPathShouldReturnExpectedString(string $path, array $params, string $expected) { $serializer = PathSerializer::create($path, $params); diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index ff820eb9..b796cffa 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -14,6 +14,17 @@ */ class XmlSerializerTest extends TestCase { + /** + * @dataProvider getEncodedToNormalizedData + */ + #[DataProvider('getEncodedToNormalizedData')] + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected) + { + $serializer = XmlSerializer::createFromString($data); + + $this->assertSame($expected, $serializer->getNormalized()); + } + public static function getEncodedToNormalizedData(): array { return [ @@ -64,16 +75,15 @@ public static function getEncodedToNormalizedData(): array } /** - * @test - * - * @dataProvider getEncodedToNormalizedData + * @dataProvider getInvalidEncodedData */ - #[DataProvider('getEncodedToNormalizedData')] - public function createFromStringDecodesToExpectedNormalizedData(string $data, $expected) + #[DataProvider('getInvalidEncodedData')] + public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data) { - $serializer = XmlSerializer::createFromString($data); + $this->expectException(SerializerException::class); + $this->expectExceptionMessage($message); - $this->assertSame($expected, $serializer->getNormalized()); + XmlSerializer::createFromString($data); } public static function getInvalidEncodedData(): array @@ -103,17 +113,14 @@ public static function getInvalidEncodedData(): array } /** - * @test - * - * @dataProvider getInvalidEncodedData + * @dataProvider getNormalizedToEncodedData */ - #[DataProvider('getInvalidEncodedData')] - public function createFromStringWithInvalidStringThrowsException(string $message, string $data) + #[DataProvider('getNormalizedToEncodedData')] + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected) { - $this->expectException(SerializerException::class); - $this->expectExceptionMessage($message); + $serializer = XmlSerializer::createFromArray($data); - XmlSerializer::createFromString($data); + $this->assertXmlStringEqualsXmlString($expected, $serializer->__toString()); } public static function getNormalizedToEncodedData(): array @@ -256,16 +263,15 @@ public static function getNormalizedToEncodedData(): array } /** - * @test - * - * @dataProvider getNormalizedToEncodedData + * @dataProvider getInvalidSerializedData */ - #[DataProvider('getNormalizedToEncodedData')] - public function createFromArrayEncodesToExpectedString(array $data, $expected) + #[DataProvider('getInvalidSerializedData')] + public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data) { - $serializer = XmlSerializer::createFromArray($data); + $this->expectException(SerializerException::class); + $this->expectExceptionMessage($message); - $this->assertXmlStringEqualsXmlString($expected, $serializer->__toString()); + XmlSerializer::createFromArray($data); } public static function getInvalidSerializedData(): array @@ -277,18 +283,4 @@ public static function getInvalidSerializedData(): array ] ]; } - - /** - * @test - * - * @dataProvider getInvalidSerializedData - */ - #[DataProvider('getInvalidSerializedData')] - public function createFromArrayWithInvalidDataThrowsException(string $message, array $data) - { - $this->expectException(SerializerException::class); - $this->expectExceptionMessage($message); - - XmlSerializer::createFromArray($data); - } } From 14f6159826fd43981d2f844663500b2b16f46327 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 11 Mar 2024 16:30:22 +0100 Subject: [PATCH 11/14] Fix code style --- tests/Unit/Api/Membership/ListByProjectTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/Api/Membership/ListByProjectTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php index f4e3e847..764d9f5b 100644 --- a/tests/Unit/Api/Membership/ListByProjectTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -72,7 +72,7 @@ public function testListByProjectWithParametersReturnsResponse() /** * @dataProvider getInvalidProjectIdentifiers */ - #[DataProvider('getInvalidProjectIdentifiers')] + #[DataProvider('getInvalidProjectIdentifiers')] public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new Membership(MockClient::create()); From 057688e79459b124f22b3d217653f33dae72096d Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 12 Mar 2024 11:56:26 +0100 Subject: [PATCH 12/14] Replace covers-annotations with CoversClass Attribute --- .../Psr18ClientRequestGenerationTest.php | 4 +- tests/Unit/Api/AbstractApi/DeleteTest.php | 5 +- tests/Unit/Api/AbstractApi/GetTest.php | 5 +- tests/Unit/Api/AbstractApi/PostTest.php | 5 +- tests/Unit/Api/AbstractApi/PutTest.php | 5 +- tests/Unit/Api/AbstractApiTest.php | 28 +-------- tests/Unit/Api/Attachment/DownloadTest.php | 5 +- tests/Unit/Api/Attachment/RemoveTest.php | 5 +- tests/Unit/Api/Attachment/ShowTest.php | 5 +- tests/Unit/Api/Attachment/UploadTest.php | 5 +- tests/Unit/Api/AttachmentTest.php | 6 +- tests/Unit/Api/CustomField/ListTest.php | 5 +- tests/Unit/Api/CustomFieldTest.php | 21 +------ tests/Unit/Api/Group/AddUserTest.php | 5 +- tests/Unit/Api/Group/CreateTest.php | 5 +- tests/Unit/Api/Group/ListTest.php | 5 +- tests/Unit/Api/Group/ShowTest.php | 5 +- tests/Unit/Api/Group/UpdateTest.php | 5 +- tests/Unit/Api/GroupTest.php | 21 +------ tests/Unit/Api/Issue/AddWatcherTest.php | 5 +- tests/Unit/Api/Issue/CreateTest.php | 32 +--------- tests/Unit/Api/Issue/ListTest.php | 5 +- tests/Unit/Api/Issue/ShowTest.php | 5 +- tests/Unit/Api/IssueCategory/CreateTest.php | 5 +- .../Api/IssueCategory/ListByProjectTest.php | 5 +- tests/Unit/Api/IssueCategory/ShowTest.php | 5 +- tests/Unit/Api/IssueCategoryTest.php | 27 +------- tests/Unit/Api/IssuePriority/ListTest.php | 5 +- tests/Unit/Api/IssuePriorityTest.php | 9 +-- tests/Unit/Api/IssueRelation/CreateTest.php | 5 +- .../Api/IssueRelation/ListByIssueIdTest.php | 5 +- tests/Unit/Api/IssueRelation/ShowTest.php | 5 +- tests/Unit/Api/IssueRelationTest.php | 12 +--- tests/Unit/Api/IssueStatus/ListTest.php | 5 +- tests/Unit/Api/IssueStatusTest.php | 17 +----- tests/Unit/Api/IssueTest.php | 37 +---------- tests/Unit/Api/Membership/CreateTest.php | 5 +- .../Unit/Api/Membership/ListByProjectTest.php | 5 +- tests/Unit/Api/MembershipTest.php | 24 +------- tests/Unit/Api/News/ListByProjectTest.php | 5 +- tests/Unit/Api/News/ListTest.php | 5 +- tests/Unit/Api/NewsTest.php | 11 +--- tests/Unit/Api/Project/ArchiveTest.php | 5 +- tests/Unit/Api/Project/CloseTest.php | 6 +- tests/Unit/Api/Project/CreateTest.php | 5 +- tests/Unit/Api/Project/ListTest.php | 5 +- tests/Unit/Api/Project/ReopenTest.php | 5 +- tests/Unit/Api/Project/ShowTest.php | 5 +- tests/Unit/Api/Project/UnarchiveTest.php | 6 +- tests/Unit/Api/ProjectTest.php | 27 +------- tests/Unit/Api/Query/ListTest.php | 5 +- tests/Unit/Api/QueryTest.php | 9 +-- tests/Unit/Api/Role/ListTest.php | 5 +- tests/Unit/Api/Role/ShowTest.php | 5 +- tests/Unit/Api/RoleTest.php | 15 +---- tests/Unit/Api/Search/ListByQueryTest.php | 6 +- tests/Unit/Api/Search/SearchTest.php | 5 +- tests/Unit/Api/TimeEntry/CreateTest.php | 5 +- tests/Unit/Api/TimeEntry/ListTest.php | 5 +- tests/Unit/Api/TimeEntry/ShowTest.php | 5 +- tests/Unit/Api/TimeEntryActivity/ListTest.php | 5 +- tests/Unit/Api/TimeEntryActivityTest.php | 9 +-- tests/Unit/Api/TimeEntryTest.php | 16 +---- tests/Unit/Api/Tracker/ListTest.php | 5 +- tests/Unit/Api/TrackerTest.php | 17 +----- tests/Unit/Api/User/CreateTest.php | 5 +- tests/Unit/Api/User/ListTest.php | 5 +- tests/Unit/Api/User/ShowTest.php | 5 +- tests/Unit/Api/UserTest.php | 29 +-------- tests/Unit/Api/Version/CreateTest.php | 5 +- tests/Unit/Api/Version/ListByProjectTest.php | 5 +- tests/Unit/Api/Version/ShowTest.php | 5 +- tests/Unit/Api/VersionTest.php | 43 +------------ tests/Unit/Api/Wiki/ListByProjectTest.php | 5 +- tests/Unit/Api/Wiki/ShowTest.php | 5 +- tests/Unit/Api/WikiTest.php | 24 +------- .../Client/NativeCurlClient/RequestTest.php | 8 +-- tests/Unit/Client/NativeCurlClientTest.php | 61 ++----------------- tests/Unit/Client/Psr18Client/RequestTest.php | 7 +-- tests/Unit/Client/Psr18ClientTest.php | 39 +----------- tests/Unit/Exception/ClientExceptionTest.php | 5 +- .../Exception/InvalidApiNameExceptionTest.php | 5 +- .../Http/HttpFactory/MakeJsonRequestTest.php | 5 +- .../Unit/Http/HttpFactory/MakeRequestTest.php | 5 +- .../Http/HttpFactory/MakeResponseTest.php | 5 +- .../Http/HttpFactory/MakeXmlRequestTest.php | 5 +- tests/Unit/Serializer/JsonSerializerTest.php | 5 +- tests/Unit/Serializer/PathSerializerTest.php | 5 +- tests/Unit/Serializer/XmlSerializerTest.php | 5 +- 89 files changed, 181 insertions(+), 690 deletions(-) diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index faf50b7c..885605b1 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -6,6 +6,7 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Utils; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; @@ -15,11 +16,10 @@ use Psr\Http\Message\StreamInterface; use Redmine\Client\Psr18Client; +#[CoversClass(Psr18Client::class)] class Psr18ClientRequestGenerationTest extends TestCase { /** - * @covers \Redmine\Client\Psr18Client - * * @dataProvider createdGetRequestsData */ #[DataProvider('createdGetRequestsData')] diff --git a/tests/Unit/Api/AbstractApi/DeleteTest.php b/tests/Unit/Api/AbstractApi/DeleteTest.php index 25ddf103..8c77dc05 100644 --- a/tests/Unit/Api/AbstractApi/DeleteTest.php +++ b/tests/Unit/Api/AbstractApi/DeleteTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use ReflectionMethod; -/** - * @covers \Redmine\Api\AbstractApi::delete - */ +#[CoversClass(AbstractApi::class)] class DeleteTest extends TestCase { public function testDeleteWithHttpClient() diff --git a/tests/Unit/Api/AbstractApi/GetTest.php b/tests/Unit/Api/AbstractApi/GetTest.php index 6635c750..7e260143 100644 --- a/tests/Unit/Api/AbstractApi/GetTest.php +++ b/tests/Unit/Api/AbstractApi/GetTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; @@ -12,9 +13,7 @@ use ReflectionMethod; use SimpleXMLElement; -/** - * @covers \Redmine\Api\AbstractApi::get - */ +#[CoversClass(AbstractApi::class)] class GetTest extends TestCase { public function testGetWithHttpClient() diff --git a/tests/Unit/Api/AbstractApi/PostTest.php b/tests/Unit/Api/AbstractApi/PostTest.php index 9bc253f9..4a2e6545 100644 --- a/tests/Unit/Api/AbstractApi/PostTest.php +++ b/tests/Unit/Api/AbstractApi/PostTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; @@ -12,9 +13,7 @@ use ReflectionMethod; use SimpleXMLElement; -/** - * @covers \Redmine\Api\AbstractApi::post - */ +#[CoversClass(AbstractApi::class)] class PostTest extends TestCase { public function testPostWithHttpClient() diff --git a/tests/Unit/Api/AbstractApi/PutTest.php b/tests/Unit/Api/AbstractApi/PutTest.php index 8eebc31b..a8709b1b 100644 --- a/tests/Unit/Api/AbstractApi/PutTest.php +++ b/tests/Unit/Api/AbstractApi/PutTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\AbstractApi; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; @@ -12,9 +13,7 @@ use ReflectionMethod; use SimpleXMLElement; -/** - * @covers \Redmine\Api\AbstractApi::put - */ +#[CoversClass(AbstractApi::class)] class PutTest extends TestCase { public function testPutWithHttpClient() diff --git a/tests/Unit/Api/AbstractApiTest.php b/tests/Unit/Api/AbstractApiTest.php index b5da425e..0c138a9b 100644 --- a/tests/Unit/Api/AbstractApiTest.php +++ b/tests/Unit/Api/AbstractApiTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Api; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\AbstractApi; @@ -14,9 +15,7 @@ use ReflectionMethod; use SimpleXMLElement; -/** - * @coversDefaultClass \Redmine\Api\AbstractApi - */ +#[CoversClass(AbstractApi::class)] class AbstractApiTest extends TestCase { public function testCreateWithHttpClientWorks() @@ -52,9 +51,6 @@ public function testCreateWithoutClitentOrHttpClientThrowsException() new class (new \stdClass()) extends AbstractApi {}; } - /** - * @covers ::get - */ public function testGetTriggersDeprecationWarning() { $client = $this->createMock(HttpClient::class); @@ -83,9 +79,6 @@ function ($errno, $errstr): bool { $api->runGet('/path.json'); } - /** - * @covers ::getLastResponse - */ public function testGetLastResponseWithHttpClientWorks() { $client = $this->createMock(HttpClient::class); @@ -95,9 +88,6 @@ public function testGetLastResponseWithHttpClientWorks() $this->assertInstanceOf(Response::class, $api->getLastResponse()); } - /** - * @covers ::post - */ public function testPostTriggersDeprecationWarning() { $client = $this->createMock(HttpClient::class); @@ -164,9 +154,6 @@ public static function getIsNotNullReturnsCorrectBooleanData(): array ]; } - /** - * @covers ::lastCallFailed - */ public function testLastCallFailedPreventsRaceCondition() { $client = AssertingHttpClient::create( @@ -211,7 +198,6 @@ public function __construct($client) } /** - * @covers ::lastCallFailed * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] @@ -226,7 +212,6 @@ public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $ } /** - * @covers ::lastCallFailed * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] @@ -321,8 +306,6 @@ public static function getLastCallFailedData(): array } /** - * @covers ::retrieveData - * * @dataProvider retrieveDataData */ #[DataProvider('retrieveDataData')] @@ -349,8 +332,6 @@ public static function retrieveDataData(): array } /** - * @covers ::retrieveData - * * @dataProvider getRetrieveDataToExceptionData */ #[DataProvider('getRetrieveDataToExceptionData')] @@ -380,8 +361,6 @@ public static function getRetrieveDataToExceptionData(): array } /** - * @covers ::retrieveAll - * * @dataProvider getRetrieveAllData */ #[DataProvider('getRetrieveAllData')] @@ -409,9 +388,6 @@ public static function getRetrieveAllData(): array ]; } - /** - * @covers ::attachCustomFieldXML - */ public function testDeprecatedAttachCustomFieldXML() { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Attachment/DownloadTest.php b/tests/Unit/Api/Attachment/DownloadTest.php index 63865912..2814c6e3 100644 --- a/tests/Unit/Api/Attachment/DownloadTest.php +++ b/tests/Unit/Api/Attachment/DownloadTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Attachment::download - */ +#[CoversClass(Attachment::class)] class DownloadTest extends TestCase { /** diff --git a/tests/Unit/Api/Attachment/RemoveTest.php b/tests/Unit/Api/Attachment/RemoveTest.php index 642a42b3..257eb9eb 100644 --- a/tests/Unit/Api/Attachment/RemoveTest.php +++ b/tests/Unit/Api/Attachment/RemoveTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Attachment::remove - */ +#[CoversClass(Attachment::class)] class RemoveTest extends TestCase { public function testRemoveReturnsString() diff --git a/tests/Unit/Api/Attachment/ShowTest.php b/tests/Unit/Api/Attachment/ShowTest.php index a6ee6c8d..0249335e 100644 --- a/tests/Unit/Api/Attachment/ShowTest.php +++ b/tests/Unit/Api/Attachment/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Attachment::show - */ +#[CoversClass(Attachment::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/Attachment/UploadTest.php b/tests/Unit/Api/Attachment/UploadTest.php index 000b1659..2816610a 100644 --- a/tests/Unit/Api/Attachment/UploadTest.php +++ b/tests/Unit/Api/Attachment/UploadTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Attachment; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Attachment::upload - */ +#[CoversClass(Attachment::class)] class UploadTest extends TestCase { /** diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index 88e2f291..1b49cbca 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -2,23 +2,21 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Attachment; use Redmine\Client\Client; /** - * @coversDefaultClass \Redmine\Api\Attachment - * * @author Malte Gerth */ + #[CoversClass(Attachment::class)] class AttachmentTest extends TestCase { /** * Test lastCallFailed(). * - * @covers ::__construct - * @covers ::lastCallFailed * @dataProvider responseCodeProvider * * @param int $responseCode diff --git a/tests/Unit/Api/CustomField/ListTest.php b/tests/Unit/Api/CustomField/ListTest.php index 3d79e09f..60803fb1 100644 --- a/tests/Unit/Api/CustomField/ListTest.php +++ b/tests/Unit/Api/CustomField/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\CustomField; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\CustomField; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\CustomField::list - */ +#[CoversClass(CustomField::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index 312bcd68..0aec8702 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\CustomField; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\CustomField - * * @author Malte Gerth */ +#[CoversClass(CustomField::class)] class CustomFieldTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -115,8 +110,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithHighLimit() { @@ -152,8 +145,6 @@ public function testAllReturnsClientGetResponseWithHighLimit() /** * Test all(). - * - * @covers ::all */ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() { @@ -194,8 +185,6 @@ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -230,8 +219,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -267,8 +254,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -304,8 +289,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/Group/AddUserTest.php b/tests/Unit/Api/Group/AddUserTest.php index ae3837ba..62306e21 100644 --- a/tests/Unit/Api/Group/AddUserTest.php +++ b/tests/Unit/Api/Group/AddUserTest.php @@ -2,15 +2,14 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Group::addUser - */ +#[CoversClass(Group::class)] class AddUserTest extends TestCase { /** diff --git a/tests/Unit/Api/Group/CreateTest.php b/tests/Unit/Api/Group/CreateTest.php index 97333eb2..1c853c2b 100644 --- a/tests/Unit/Api/Group/CreateTest.php +++ b/tests/Unit/Api/Group/CreateTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; @@ -12,9 +13,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Group::create - */ +#[CoversClass(Group::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/Group/ListTest.php b/tests/Unit/Api/Group/ListTest.php index ff41c229..6f9f403c 100644 --- a/tests/Unit/Api/Group/ListTest.php +++ b/tests/Unit/Api/Group/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Group::list - */ +#[CoversClass(Group::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Group/ShowTest.php b/tests/Unit/Api/Group/ShowTest.php index 81a41266..c2c50d95 100644 --- a/tests/Unit/Api/Group/ShowTest.php +++ b/tests/Unit/Api/Group/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Group::show - */ +#[CoversClass(Group::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/Group/UpdateTest.php b/tests/Unit/Api/Group/UpdateTest.php index e75ac708..5bc216d5 100644 --- a/tests/Unit/Api/Group/UpdateTest.php +++ b/tests/Unit/Api/Group/UpdateTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Api\Group; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Group::update - */ +#[CoversClass(Group::class)] class UpdateTest extends TestCase { public function testUpdateWithNameUpdatesGroup() diff --git a/tests/Unit/Api/GroupTest.php b/tests/Unit/Api/GroupTest.php index 85caac8d..e2bc83ff 100644 --- a/tests/Unit/Api/GroupTest.php +++ b/tests/Unit/Api/GroupTest.php @@ -4,6 +4,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Group; @@ -11,16 +12,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Group - * * @author Malte Gerth */ +#[CoversClass(Group::class)] class GroupTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -46,7 +44,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -83,8 +80,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -120,8 +115,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -156,8 +149,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -193,8 +184,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -230,9 +219,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -270,9 +256,6 @@ public function testRemoveCallsDelete() /** * Test removeUser(). - * - * @covers ::delete - * @covers ::removeUser */ public function testRemoveUserCallsDelete() { diff --git a/tests/Unit/Api/Issue/AddWatcherTest.php b/tests/Unit/Api/Issue/AddWatcherTest.php index f2de8774..dae6884a 100644 --- a/tests/Unit/Api/Issue/AddWatcherTest.php +++ b/tests/Unit/Api/Issue/AddWatcherTest.php @@ -2,15 +2,14 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Issue::addWatcher - */ +#[CoversClass(Issue::class)] class AddWatcherTest extends TestCase { /** diff --git a/tests/Unit/Api/Issue/CreateTest.php b/tests/Unit/Api/Issue/CreateTest.php index e767394c..1cca0bd0 100644 --- a/tests/Unit/Api/Issue/CreateTest.php +++ b/tests/Unit/Api/Issue/CreateTest.php @@ -2,15 +2,14 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Issue::create - */ +#[CoversClass(Issue::class)] class CreateTest extends TestCase { /** @@ -257,10 +256,6 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - /** - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getIssueStatusApi - */ public function testCreateWithHttpClientRetrievesIssueStatusId() { $client = AssertingHttpClient::create( @@ -298,10 +293,6 @@ public function testCreateWithHttpClientRetrievesIssueStatusId() ); } - /** - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getProjectApi - */ public function testCreateWithHttpClientRetrievesProjectId() { $client = AssertingHttpClient::create( @@ -339,10 +330,6 @@ public function testCreateWithHttpClientRetrievesProjectId() ); } - /** - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getIssueCategoryApi - */ public function testCreateWithHttpClientRetrievesIssueCategoryId() { $client = AssertingHttpClient::create( @@ -380,10 +367,6 @@ public function testCreateWithHttpClientRetrievesIssueCategoryId() ); } - /** - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getTrackerApi - */ public function testCreateWithHttpClientRetrievesTrackerId() { $client = AssertingHttpClient::create( @@ -421,10 +404,6 @@ public function testCreateWithHttpClientRetrievesTrackerId() ); } - /** - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getUserApi - */ public function testCreateWithHttpClientRetrievesUserId() { $client = AssertingHttpClient::create( @@ -464,13 +443,6 @@ public function testCreateWithHttpClientRetrievesUserId() /** * Test cleanParams(). - * - * @covers \Redmine\Api\Issue::cleanParams - * @covers \Redmine\Api\Issue::getIssueCategoryApi - * @covers \Redmine\Api\Issue::getIssueStatusApi - * @covers \Redmine\Api\Issue::getProjectApi - * @covers \Redmine\Api\Issue::getTrackerApi - * @covers \Redmine\Api\Issue::getUserApi */ public function testCreateWithClientCleansParameters() { diff --git a/tests/Unit/Api/Issue/ListTest.php b/tests/Unit/Api/Issue/ListTest.php index 3a9ea99c..ee3899ed 100644 --- a/tests/Unit/Api/Issue/ListTest.php +++ b/tests/Unit/Api/Issue/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Issue::list - */ +#[CoversClass(Issue::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Issue/ShowTest.php b/tests/Unit/Api/Issue/ShowTest.php index 7bd78306..c9da9e70 100644 --- a/tests/Unit/Api/Issue/ShowTest.php +++ b/tests/Unit/Api/Issue/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Issue; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Issue::show - */ +#[CoversClass(Issue::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/IssueCategory/CreateTest.php b/tests/Unit/Api/IssueCategory/CreateTest.php index 270c1303..b3fce28f 100644 --- a/tests/Unit/Api/IssueCategory/CreateTest.php +++ b/tests/Unit/Api/IssueCategory/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; @@ -10,9 +11,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\IssueCategory::create - */ +#[CoversClass(IssueCategory::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/IssueCategory/ListByProjectTest.php b/tests/Unit/Api/IssueCategory/ListByProjectTest.php index b3bfafca..52a0b920 100644 --- a/tests/Unit/Api/IssueCategory/ListByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\MockClient; use stdClass; -/** - * @covers \Redmine\Api\IssueCategory::listByProject - */ +#[CoversClass(IssueCategory::class)] class ListByProjectTest extends TestCase { public function testListByProjectWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/IssueCategory/ShowTest.php b/tests/Unit/Api/IssueCategory/ShowTest.php index e46b556d..23244d9e 100644 --- a/tests/Unit/Api/IssueCategory/ShowTest.php +++ b/tests/Unit/Api/IssueCategory/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\IssueCategory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\IssueCategory::show - */ +#[CoversClass(IssueCategory::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index f01cc9b9..b232ee2e 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -2,24 +2,21 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueCategory; use Redmine\Client\Client; -use Redmine\Exception\MissingParameterException; use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\IssueCategory - * * @author Malte Gerth */ +#[CoversClass(IssueCategory::class)] class IssueCategoryTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -45,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllDAta */ #[DataProvider('getAllData')] @@ -85,8 +81,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -123,8 +117,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -159,8 +151,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -196,8 +186,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -233,9 +221,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -266,9 +251,6 @@ public function testRemoveCallsDelete() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDeleteWithParameters() { @@ -304,8 +286,6 @@ public function testRemoveCallsDeleteWithParameters() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { @@ -337,9 +317,6 @@ public function testGetIdByNameMakesGetRequest() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/IssuePriority/ListTest.php b/tests/Unit/Api/IssuePriority/ListTest.php index 19a3a540..eb3c541b 100644 --- a/tests/Unit/Api/IssuePriority/ListTest.php +++ b/tests/Unit/Api/IssuePriority/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\IssuePriority; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\IssuePriority; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\IssuePriority::list - */ +#[CoversClass(IssuePriority::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/IssuePriorityTest.php b/tests/Unit/Api/IssuePriorityTest.php index fe35eb97..7a2ea1ee 100644 --- a/tests/Unit/Api/IssuePriorityTest.php +++ b/tests/Unit/Api/IssuePriorityTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssuePriority; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\IssuePriority - * * @author Malte Gerth */ +#[CoversClass(IssuePriority::class)] class IssuePriorityTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/IssueRelation/CreateTest.php b/tests/Unit/Api/IssueRelation/CreateTest.php index 60100842..b59a7645 100644 --- a/tests/Unit/Api/IssueRelation/CreateTest.php +++ b/tests/Unit/Api/IssueRelation/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\IssueRelation; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; @@ -10,9 +11,7 @@ use Redmine\Http\HttpClient; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\IssueRelation::create - */ +#[CoversClass(IssueRelation::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php index a69a613d..d230015f 100644 --- a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php +++ b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\IssueRelation; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\IssueRelation::listByIssueId - */ +#[CoversClass(IssueRelation::class)] class ListByIssueIdTest extends TestCase { public function testListByIssueIdWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/IssueRelation/ShowTest.php b/tests/Unit/Api/IssueRelation/ShowTest.php index 9b35490b..9c90db84 100644 --- a/tests/Unit/Api/IssueRelation/ShowTest.php +++ b/tests/Unit/Api/IssueRelation/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\IssueRelation; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\IssueRelation::show - */ +#[CoversClass(IssueRelation::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index ad21102e..fa9a3e2a 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueRelation; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\IssueRelation - * * @author Malte Gerth */ +#[CoversClass(IssueRelation::class)] class IssueRelationTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -118,9 +113,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { diff --git a/tests/Unit/Api/IssueStatus/ListTest.php b/tests/Unit/Api/IssueStatus/ListTest.php index 9affbd5d..9e4e573c 100644 --- a/tests/Unit/Api/IssueStatus/ListTest.php +++ b/tests/Unit/Api/IssueStatus/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\IssueStatus; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueStatus; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\IssueStatus::list - */ +#[CoversClass(IssueStatus::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/IssueStatusTest.php b/tests/Unit/Api/IssueStatusTest.php index e865ff5e..767f8b1b 100644 --- a/tests/Unit/Api/IssueStatusTest.php +++ b/tests/Unit/Api/IssueStatusTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\IssueStatus; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\IssueStatus - * * @author Malte Gerth */ +#[CoversClass(IssueStatus::class)] class IssueStatusTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -118,8 +113,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -154,8 +147,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -191,8 +182,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -228,8 +217,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/IssueTest.php b/tests/Unit/Api/IssueTest.php index 470158d2..23722a85 100644 --- a/tests/Unit/Api/IssueTest.php +++ b/tests/Unit/Api/IssueTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Issue; @@ -11,10 +12,9 @@ use SimpleXMLElement; /** - * @coversDefaultClass \Redmine\Api\Issue - * * @author Malte Gerth */ +#[CoversClass(Issue::class)] class IssueTest extends TestCase { public static function getPriorityConstantsData(): array @@ -41,8 +41,6 @@ public function testPriorityConstants($expected, $value) /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -68,7 +66,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -105,8 +102,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -142,9 +137,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -178,9 +170,6 @@ public function testRemoveCallsDelete() /** * Test attach(). - * - * @covers ::attach - * @covers ::put */ public function testAttachCallsPut() { @@ -225,8 +214,6 @@ public function testAttachCallsPut() /** * Test removeWatcher(). - * - * @covers ::removeWatcher */ public function testRemoveWatcherCallsPost() { @@ -254,14 +241,6 @@ public function testRemoveWatcherCallsPost() /** * Test cleanParams() with Client for BC - * - * @covers ::create - * @covers ::cleanParams - * @covers ::getIssueCategoryApi - * @covers ::getIssueStatusApi - * @covers ::getProjectApi - * @covers ::getTrackerApi - * @covers ::getUserApi */ public function testCreateWithClientCleansParameters() { @@ -335,9 +314,6 @@ public function testCreateWithClientCleansParameters() /** * Test update(). - * - * @covers ::update - * @covers ::put */ public function testUpdateCallsPut() { @@ -367,9 +343,6 @@ public function testUpdateCallsPut() /** * Test update(). - * - * @covers ::update - * @covers ::cleanParams */ public function testUpdateCleansParameters() { @@ -441,8 +414,6 @@ public function testUpdateCleansParameters() /** * Test setIssueStatus(). - * - * @covers ::setIssueStatus */ public function testSetIssueStatusWithClient() { @@ -486,8 +457,6 @@ public function testSetIssueStatusWithClient() /** * Test setIssueStatus(). - * - * @covers ::setIssueStatus */ public function testSetIssueStatusWithHttpClient() { @@ -528,8 +497,6 @@ public function testSetIssueStatusWithHttpClient() /** * Test addNoteToIssue(). - * - * @covers ::addNoteToIssue */ public function testAddNoteToIssue() { diff --git a/tests/Unit/Api/Membership/CreateTest.php b/tests/Unit/Api/Membership/CreateTest.php index 8e954fa4..59f0dd04 100644 --- a/tests/Unit/Api/Membership/CreateTest.php +++ b/tests/Unit/Api/Membership/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Membership; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; @@ -10,9 +11,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Membership::create - */ +#[CoversClass(Membership::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/Membership/ListByProjectTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php index 764d9f5b..c6c4483d 100644 --- a/tests/Unit/Api/Membership/ListByProjectTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Membership; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\MockClient; use stdClass; -/** - * @covers \Redmine\Api\Membership::listByProject - */ +#[CoversClass(Membership::class)] class ListByProjectTest extends TestCase { public function testListByProjectWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index 41b55464..53f7b9ab 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -3,24 +3,21 @@ namespace Redmine\Tests\Unit\Api; use Exception; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Membership; use Redmine\Client\Client; -use Redmine\Exception\MissingParameterException; use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Membership - * * @author Malte Gerth */ +#[CoversClass(Membership::class)] class MembershipTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -46,7 +43,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -83,8 +79,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -120,9 +114,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -156,8 +147,6 @@ public function testRemoveCallsDelete() /** * Test removeMember(). - * - * @covers ::removeMember */ public function testRemoveMemberCallsDelete() { @@ -202,8 +191,6 @@ public function testRemoveMemberCallsDelete() /** * Test removeMember(). - * - * @covers ::removeMember */ public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() { @@ -229,8 +216,6 @@ public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() /** * Test removeMember(). - * - * @covers ::removeMember */ public function testRemoveMemberReturnsFalseIfMemberlistIsMissing() { @@ -257,8 +242,6 @@ public function testRemoveMemberReturnsFalseIfMemberlistIsMissing() /** * Test update(). * - * @covers ::update - * */ public function testUpdateThrowsExceptionIfRoleIdsAreMissingInParameters() { @@ -280,9 +263,6 @@ public function testUpdateThrowsExceptionIfRoleIdsAreMissingInParameters() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/News/ListByProjectTest.php b/tests/Unit/Api/News/ListByProjectTest.php index 39dee26e..4fa4db83 100644 --- a/tests/Unit/Api/News/ListByProjectTest.php +++ b/tests/Unit/Api/News/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\News; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\News; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\MockClient; use stdClass; -/** - * @covers \Redmine\Api\News::listByProject - */ +#[CoversClass(News::class)] class ListByProjectTest extends TestCase { public function testListByProjectWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/News/ListTest.php b/tests/Unit/Api/News/ListTest.php index ec31cf16..ae6eee9d 100644 --- a/tests/Unit/Api/News/ListTest.php +++ b/tests/Unit/Api/News/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\News; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\News; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\News::list - */ +#[CoversClass(News::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/NewsTest.php b/tests/Unit/Api/NewsTest.php index 3f8f9dda..1c9f2545 100644 --- a/tests/Unit/Api/NewsTest.php +++ b/tests/Unit/Api/NewsTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\News; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\News - * * @author Malte Gerth */ +#[CoversClass(News::class)] class NewsTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithProject() { @@ -115,8 +110,6 @@ public function testAllReturnsClientGetResponseWithProject() /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { diff --git a/tests/Unit/Api/Project/ArchiveTest.php b/tests/Unit/Api/Project/ArchiveTest.php index 9d6bb9dd..3e703897 100644 --- a/tests/Unit/Api/Project/ArchiveTest.php +++ b/tests/Unit/Api/Project/ArchiveTest.php @@ -5,15 +5,14 @@ namespace Redmine\Tests\Unit\Api\Project; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Exception\UnexpectedResponseException; use Redmine\Http\HttpClient; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Project::archive - */ +#[CoversClass(Project::class)] class ArchiveTest extends TestCase { public function testArchiveReturnsTrue() diff --git a/tests/Unit/Api/Project/CloseTest.php b/tests/Unit/Api/Project/CloseTest.php index cacfbfc4..f40bb2b4 100644 --- a/tests/Unit/Api/Project/CloseTest.php +++ b/tests/Unit/Api/Project/CloseTest.php @@ -3,16 +3,14 @@ namespace Redmine\Tests\Unit\Api\Project; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Exception\UnexpectedResponseException; use Redmine\Http\HttpClient; -use Redmine\Http\Response; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Project::close - */ +#[CoversClass(Project::class)] class CloseTest extends TestCase { public function testCloseReturnsTrue() diff --git a/tests/Unit/Api/Project/CreateTest.php b/tests/Unit/Api/Project/CreateTest.php index 7f5cfad8..98cfdae8 100644 --- a/tests/Unit/Api/Project/CreateTest.php +++ b/tests/Unit/Api/Project/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Project; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; @@ -10,9 +11,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Project::create - */ +#[CoversClass(Project::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/Project/ListTest.php b/tests/Unit/Api/Project/ListTest.php index e85de578..efe1fee6 100644 --- a/tests/Unit/Api/Project/ListTest.php +++ b/tests/Unit/Api/Project/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Project; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Project::list - */ +#[CoversClass(Project::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Project/ReopenTest.php b/tests/Unit/Api/Project/ReopenTest.php index 6978783c..f9426ffb 100644 --- a/tests/Unit/Api/Project/ReopenTest.php +++ b/tests/Unit/Api/Project/ReopenTest.php @@ -3,15 +3,14 @@ namespace Redmine\Tests\Unit\Api\Project; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Exception\UnexpectedResponseException; use Redmine\Http\HttpClient; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Project::reopen - */ +#[CoversClass(Project::class)] class ReopenTest extends TestCase { public function testReopenReturnsTrue() diff --git a/tests/Unit/Api/Project/ShowTest.php b/tests/Unit/Api/Project/ShowTest.php index 8f906d78..f8d4c663 100644 --- a/tests/Unit/Api/Project/ShowTest.php +++ b/tests/Unit/Api/Project/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Project; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Project::show - */ +#[CoversClass(Project::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/Project/UnarchiveTest.php b/tests/Unit/Api/Project/UnarchiveTest.php index 0ac0eaf0..84776bf2 100644 --- a/tests/Unit/Api/Project/UnarchiveTest.php +++ b/tests/Unit/Api/Project/UnarchiveTest.php @@ -3,16 +3,14 @@ namespace Redmine\Tests\Unit\Api\Project; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Exception\UnexpectedResponseException; use Redmine\Http\HttpClient; -use Redmine\Http\Response; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Project::unarchive - */ +#[CoversClass(Project::class)] class UnarchiveTest extends TestCase { public function testUnarchiveReturnsTrue() diff --git a/tests/Unit/Api/ProjectTest.php b/tests/Unit/Api/ProjectTest.php index 52e8d090..32b09e40 100644 --- a/tests/Unit/Api/ProjectTest.php +++ b/tests/Unit/Api/ProjectTest.php @@ -2,26 +2,23 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Project; use Redmine\Client\Client; -use Redmine\Exception\MissingParameterException; use Redmine\Tests\Fixtures\MockClient; use ReflectionMethod; use SimpleXMLElement; /** - * @coversDefaultClass \Redmine\Api\Project - * * @author Malte Gerth */ +#[CoversClass(Project::class)] class ProjectTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -47,7 +44,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -84,8 +80,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -121,9 +115,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -149,8 +140,6 @@ public function testRemoveCallsDelete() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -185,8 +174,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -222,8 +209,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -259,8 +244,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { @@ -292,9 +275,6 @@ public function testGetIdByNameMakesGetRequest() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { @@ -321,9 +301,6 @@ public function testUpdateCallsPut() $this->assertSame($response, $api->update(5, $parameters)); } - /** - * @covers \Redmine\Api\Project::prepareParamsXml - */ public function testDeprecatedPrepareParamsXml() { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Query/ListTest.php b/tests/Unit/Api/Query/ListTest.php index fd39cc35..e000b977 100644 --- a/tests/Unit/Api/Query/ListTest.php +++ b/tests/Unit/Api/Query/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Query; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Query; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Query::list - */ +#[CoversClass(Query::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/QueryTest.php b/tests/Unit/Api/QueryTest.php index 2ebfb09f..10411455 100644 --- a/tests/Unit/Api/QueryTest.php +++ b/tests/Unit/Api/QueryTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Query; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Query - * * @author Malte Gerth */ +#[CoversClass(Query::class)] class QueryTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/Role/ListTest.php b/tests/Unit/Api/Role/ListTest.php index ec1dd55f..b0026edd 100644 --- a/tests/Unit/Api/Role/ListTest.php +++ b/tests/Unit/Api/Role/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Role; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Role; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Role::list - */ +#[CoversClass(Role::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Role/ShowTest.php b/tests/Unit/Api/Role/ShowTest.php index 3050c796..4dd64df3 100644 --- a/tests/Unit/Api/Role/ShowTest.php +++ b/tests/Unit/Api/Role/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Role; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Role; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Role::show - */ +#[CoversClass(Role::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/RoleTest.php b/tests/Unit/Api/RoleTest.php index 479020d9..51263ba6 100644 --- a/tests/Unit/Api/RoleTest.php +++ b/tests/Unit/Api/RoleTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Role; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Role - * * @author Malte Gerth */ +#[CoversClass(Role::class)] class RoleTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -118,8 +113,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -154,8 +147,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -191,8 +182,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { diff --git a/tests/Unit/Api/Search/ListByQueryTest.php b/tests/Unit/Api/Search/ListByQueryTest.php index 3d284e0a..d80515c1 100644 --- a/tests/Unit/Api/Search/ListByQueryTest.php +++ b/tests/Unit/Api/Search/ListByQueryTest.php @@ -2,15 +2,13 @@ namespace Redmine\Tests\Unit\Api\Search; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Search; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -use Redmine\Tests\Fixtures\MockClient; -/** - * @covers \Redmine\Api\Search::listByQuery - */ +#[CoversClass(Search::class)] class ListByQueryTest extends TestCase { public function testListByQueryWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Search/SearchTest.php b/tests/Unit/Api/Search/SearchTest.php index c3e78596..def15aee 100644 --- a/tests/Unit/Api/Search/SearchTest.php +++ b/tests/Unit/Api/Search/SearchTest.php @@ -2,15 +2,14 @@ namespace Redmine\Tests\Unit\Api\Search; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Search; use Redmine\Client\Client; use Redmine\Tests\Fixtures\MockClient; -/** - * @covers \Redmine\Api\Search::search - */ +#[CoversClass(Search::class)] class SearchTest extends TestCase { public function testSearchTriggersDeprecationWarning() diff --git a/tests/Unit/Api/TimeEntry/CreateTest.php b/tests/Unit/Api/TimeEntry/CreateTest.php index 58456315..4bbbb7c2 100644 --- a/tests/Unit/Api/TimeEntry/CreateTest.php +++ b/tests/Unit/Api/TimeEntry/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\TimeEntry; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; @@ -10,9 +11,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\TimeEntry::create - */ +#[CoversClass(TimeEntry::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/TimeEntry/ListTest.php b/tests/Unit/Api/TimeEntry/ListTest.php index 963414b0..0524d9da 100644 --- a/tests/Unit/Api/TimeEntry/ListTest.php +++ b/tests/Unit/Api/TimeEntry/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\TimeEntry; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\TimeEntry::list - */ +#[CoversClass(TimeEntry::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/TimeEntry/ShowTest.php b/tests/Unit/Api/TimeEntry/ShowTest.php index c886916f..c6444407 100644 --- a/tests/Unit/Api/TimeEntry/ShowTest.php +++ b/tests/Unit/Api/TimeEntry/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\TimeEntry; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\TimeEntry::show - */ +#[CoversClass(TimeEntry::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/TimeEntryActivity/ListTest.php b/tests/Unit/Api/TimeEntryActivity/ListTest.php index 439817dc..38127a3d 100644 --- a/tests/Unit/Api/TimeEntryActivity/ListTest.php +++ b/tests/Unit/Api/TimeEntryActivity/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\TimeEntryActivity; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntryActivity; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @coversDefaultClass \Redmine\Api\TimeEntryActivity::list - */ +#[CoversClass(TimeEntryActivity::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/TimeEntryActivityTest.php b/tests/Unit/Api/TimeEntryActivityTest.php index 374255c0..e74118d7 100644 --- a/tests/Unit/Api/TimeEntryActivityTest.php +++ b/tests/Unit/Api/TimeEntryActivityTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntryActivity; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\TimeEntryActivity - * * @author Malte Gerth */ +#[CoversClass(TimeEntryActivity::class)] class TimeEntryActivityTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php index 50cce4fa..f228d1c3 100644 --- a/tests/Unit/Api/TimeEntryTest.php +++ b/tests/Unit/Api/TimeEntryTest.php @@ -2,24 +2,21 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\TimeEntry; use Redmine\Client\Client; -use Redmine\Exception\MissingParameterException; use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\TimeEntry - * * @author Malte Gerth */ +#[CoversClass(TimeEntry::class)] class TimeEntryTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -45,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -82,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -125,9 +119,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -153,9 +144,6 @@ public function testRemoveCallsDelete() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { diff --git a/tests/Unit/Api/Tracker/ListTest.php b/tests/Unit/Api/Tracker/ListTest.php index 8318b44b..5e9ac948 100644 --- a/tests/Unit/Api/Tracker/ListTest.php +++ b/tests/Unit/Api/Tracker/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Tracker; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\Tracker; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\Tracker::list - */ +#[CoversClass(Tracker::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/TrackerTest.php b/tests/Unit/Api/TrackerTest.php index 76590f8b..4ba07e45 100644 --- a/tests/Unit/Api/TrackerTest.php +++ b/tests/Unit/Api/TrackerTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Tracker; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Tracker - * * @author Malte Gerth */ +#[CoversClass(Tracker::class)] class TrackerTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParametersAndProject() { @@ -118,8 +113,6 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -154,8 +147,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -191,8 +182,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -228,8 +217,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { diff --git a/tests/Unit/Api/User/CreateTest.php b/tests/Unit/Api/User/CreateTest.php index 600e90ce..556f67ae 100644 --- a/tests/Unit/Api/User/CreateTest.php +++ b/tests/Unit/Api/User/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\User; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; @@ -10,9 +11,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\User::create - */ +#[CoversClass(User::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/User/ListTest.php b/tests/Unit/Api/User/ListTest.php index 8d0f1311..ab12faf7 100644 --- a/tests/Unit/Api/User/ListTest.php +++ b/tests/Unit/Api/User/ListTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\User; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Api\User; use Redmine\Client\Client; use Redmine\Exception\UnexpectedResponseException; -/** - * @covers \Redmine\Api\User::list - */ +#[CoversClass(User::class)] class ListTest extends TestCase { public function testListWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/User/ShowTest.php b/tests/Unit/Api/User/ShowTest.php index 95d0cb8c..9de66df5 100644 --- a/tests/Unit/Api/User/ShowTest.php +++ b/tests/Unit/Api/User/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\User; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\User::show - */ +#[CoversClass(User::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/UserTest.php b/tests/Unit/Api/UserTest.php index 02d9fc37..ad34c0fc 100644 --- a/tests/Unit/Api/UserTest.php +++ b/tests/Unit/Api/UserTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\User; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\User - * * @author Malte Gerth */ +#[CoversClass(User::class)] class UserTest extends TestCase { /** * Test getCurrentUser(). - * - * @covers ::getCurrentUser */ public function testGetCurrentUserReturnsClientGetResponse() { @@ -53,8 +51,6 @@ public function testGetCurrentUserReturnsClientGetResponse() /** * Test getIdByUsername(). - * - * @covers ::getIdByUsername */ public function testGetIdByUsernameMakesGetRequest() { @@ -89,8 +85,6 @@ public function testGetIdByUsernameMakesGetRequest() /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -116,7 +110,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -153,8 +146,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -194,9 +185,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -222,9 +210,6 @@ public function testRemoveCallsDelete() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { @@ -260,10 +245,6 @@ public function testUpdateCallsPut() /** * Test update(). - * - * @covers ::put - * @covers ::update - * @covers ::attachCustomFieldXML */ public function testUpdateWithCustomField() { @@ -308,8 +289,6 @@ public function testUpdateWithCustomField() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -344,8 +323,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -381,8 +358,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { diff --git a/tests/Unit/Api/Version/CreateTest.php b/tests/Unit/Api/Version/CreateTest.php index 5db33426..e54e780f 100644 --- a/tests/Unit/Api/Version/CreateTest.php +++ b/tests/Unit/Api/Version/CreateTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\AssertingHttpClient; use SimpleXMLElement; -/** - * @covers \Redmine\Api\Version::create - */ +#[CoversClass(Version::class)] class CreateTest extends TestCase { /** diff --git a/tests/Unit/Api/Version/ListByProjectTest.php b/tests/Unit/Api/Version/ListByProjectTest.php index 53f25d40..d993f65d 100644 --- a/tests/Unit/Api/Version/ListByProjectTest.php +++ b/tests/Unit/Api/Version/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\MockClient; use stdClass; -/** - * @covers \Redmine\Api\Version::listByProject - */ +#[CoversClass(Version::class)] class ListByProjectTest extends TestCase { public function testListByProjectWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Version/ShowTest.php b/tests/Unit/Api/Version/ShowTest.php index 884d99c6..15286c8a 100644 --- a/tests/Unit/Api/Version/ShowTest.php +++ b/tests/Unit/Api/Version/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Version; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Version::show - */ +#[CoversClass(Version::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/VersionTest.php b/tests/Unit/Api/VersionTest.php index 0d0f4cd5..643ce7f2 100644 --- a/tests/Unit/Api/VersionTest.php +++ b/tests/Unit/Api/VersionTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Version; @@ -10,16 +11,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Version - * * @author Malte Gerth */ +#[CoversClass(Version::class)] class VersionTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -45,7 +43,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -82,8 +79,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -123,9 +118,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveWithNumericIdCallsDelete() { @@ -151,9 +143,6 @@ public function testRemoveWithNumericIdCallsDelete() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveWithStringCallsDelete() { @@ -180,9 +169,6 @@ public function testRemoveWithStringCallsDelete() /** * Test update(). * - * @covers ::update - * @covers ::validateStatus - * */ public function testUpdateThrowsExceptionWithInvalidStatus() { @@ -207,9 +193,6 @@ public function testUpdateThrowsExceptionWithInvalidStatus() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { @@ -245,10 +228,6 @@ public function testUpdateCallsPut() /** * Test update(). - * - * @covers ::update - * @covers ::put - * @covers ::validateStatus */ public function testUpdateWithValidStatusCallsPut() { @@ -286,8 +265,6 @@ public function testUpdateWithValidStatusCallsPut() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsNameIdArray() { @@ -320,8 +297,6 @@ public function testListingReturnsNameIdArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingReturnsIdNameIfReverseIsFalseArray() { @@ -354,8 +329,6 @@ public function testListingReturnsIdNameIfReverseIsFalseArray() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetOnlyTheFirstTime() { @@ -389,8 +362,6 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). - * - * @covers ::listing */ public function testListingCallsGetEveryTimeWithForceUpdate() { @@ -424,8 +395,6 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test getIdByName(). - * - * @covers ::getIdByName */ public function testGetIdByNameMakesGetRequest() { @@ -458,8 +427,6 @@ public function testGetIdByNameMakesGetRequest() /** * Test validateSharing(). * - * @covers ::create - * @covers ::validateSharing * @dataProvider invalidSharingProvider * * @@ -490,8 +457,6 @@ public function testCreateThrowsExceptionWithInvalidSharing($sharingValue) /** * Test validateSharing(). * - * @covers ::update - * @covers ::validateSharing * @dataProvider validSharingProvider * * @param string $sharingValue @@ -535,8 +500,6 @@ public function testUpdateWithValidSharing($sharingValue, $sharingXmlElement) /** * Test validateSharing(). * - * @covers ::update - * @covers ::validateSharing * @dataProvider validEmptySharingProvider * * @param string $sharingValue @@ -581,8 +544,6 @@ public function testUpdateWithValidEmptySharing($sharingValue) /** * Test validateSharing(). * - * @covers ::update - * @covers ::validateSharing * @dataProvider invalidSharingProvider * * diff --git a/tests/Unit/Api/Wiki/ListByProjectTest.php b/tests/Unit/Api/Wiki/ListByProjectTest.php index 4d88fd30..31381a22 100644 --- a/tests/Unit/Api/Wiki/ListByProjectTest.php +++ b/tests/Unit/Api/Wiki/ListByProjectTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api\Wiki; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; @@ -11,9 +12,7 @@ use Redmine\Tests\Fixtures\MockClient; use stdClass; -/** - * @covers \Redmine\Api\Wiki::listByProject - */ +#[CoversClass(Wiki::class)] class ListByProjectTest extends TestCase { public function testListByProjectWithoutParametersReturnsResponse() diff --git a/tests/Unit/Api/Wiki/ShowTest.php b/tests/Unit/Api/Wiki/ShowTest.php index 9300ab4a..eb6b2fb5 100644 --- a/tests/Unit/Api/Wiki/ShowTest.php +++ b/tests/Unit/Api/Wiki/ShowTest.php @@ -2,14 +2,13 @@ namespace Redmine\Tests\Unit\Api\Wiki; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; use Redmine\Tests\Fixtures\AssertingHttpClient; -/** - * @covers \Redmine\Api\Wiki::show - */ +#[CoversClass(Wiki::class)] class ShowTest extends TestCase { /** diff --git a/tests/Unit/Api/WikiTest.php b/tests/Unit/Api/WikiTest.php index 51a3a33a..1f3e9f75 100644 --- a/tests/Unit/Api/WikiTest.php +++ b/tests/Unit/Api/WikiTest.php @@ -2,6 +2,7 @@ namespace Redmine\Tests\Unit\Api; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Api\Wiki; @@ -9,16 +10,13 @@ use Redmine\Tests\Fixtures\MockClient; /** - * @coversDefaultClass \Redmine\Api\Wiki - * * @author Malte Gerth */ +#[CoversClass(Wiki::class)] class WikiTest extends TestCase { /** * Test all(). - * - * @covers ::all */ public function testAllTriggersDeprecationWarning() { @@ -44,7 +42,6 @@ function ($errno, $errstr): bool { /** * Test all(). * - * @covers ::all * @dataProvider getAllData */ #[DataProvider('getAllData')] @@ -81,8 +78,6 @@ public static function getAllData(): array /** * Test all(). - * - * @covers ::all */ public function testAllReturnsClientGetResponseWithParameters() { @@ -122,9 +117,6 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test remove(). - * - * @covers ::delete - * @covers ::remove */ public function testRemoveCallsDelete() { @@ -150,9 +142,6 @@ public function testRemoveCallsDelete() /** * Test create(). - * - * @covers ::create - * @covers ::post */ public function testCreateCallsPost() { @@ -181,9 +170,6 @@ public function testCreateCallsPost() /** * Test create(). - * - * @covers ::create - * @covers ::post */ public function testCreateWithParametersCallsPost() { @@ -223,9 +209,6 @@ public function testCreateWithParametersCallsPost() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateCallsPut() { @@ -254,9 +237,6 @@ public function testUpdateCallsPut() /** * Test update(). - * - * @covers ::put - * @covers ::update */ public function testUpdateWithParametersCallsPut() { diff --git a/tests/Unit/Client/NativeCurlClient/RequestTest.php b/tests/Unit/Client/NativeCurlClient/RequestTest.php index 936d0a86..63523a24 100644 --- a/tests/Unit/Client/NativeCurlClient/RequestTest.php +++ b/tests/Unit/Client/NativeCurlClient/RequestTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Client\NativeCurlClientTest; use phpmock\phpunit\PHPMock; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Client\NativeCurlClient; @@ -10,12 +11,7 @@ use Redmine\Http\Response; use stdClass; -/** - * @covers \Redmine\Client\NativeCurlClient::request - * @covers \Redmine\Client\NativeCurlClient::runRequest - * @covers \Redmine\Client\NativeCurlClient::createCurl - * @covers \Redmine\Client\NativeCurlClient::createHttpHeader - */ +#[CoversClass(NativeCurlClient::class)] class RequestTest extends TestCase { use PHPMock; diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 4438c847..f5004348 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; use phpmock\phpunit\PHPMock; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Client\Client; @@ -14,6 +15,8 @@ use Redmine\Http\HttpClient; use stdClass; + +#[CoversClass(NativeCurlClient::class)] class NativeCurlClientTest extends TestCase { use PHPMock; @@ -33,9 +36,6 @@ class NativeCurlClientTest extends TestCase CURLOPT_RETURNTRANSFER => 1, ]; - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testApiKeyShouldBePassToConstructor() { $client = new NativeCurlClient( @@ -48,9 +48,6 @@ public function testApiKeyShouldBePassToConstructor() $this->assertInstanceOf(HttpClient::class, $client); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testShouldPassUsernameAndPasswordToConstructor() { $client = new NativeCurlClient( @@ -63,9 +60,6 @@ public function testShouldPassUsernameAndPasswordToConstructor() $this->assertInstanceOf(Client::class, $client); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testGetLastResponseStatusCodeIsInitialNull() { $client = new NativeCurlClient( @@ -76,9 +70,6 @@ public function testGetLastResponseStatusCodeIsInitialNull() $this->assertSame(0, $client->getLastResponseStatusCode()); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testGetLastResponseContentTypeIsInitialEmpty() { $client = new NativeCurlClient( @@ -89,9 +80,6 @@ public function testGetLastResponseContentTypeIsInitialEmpty() $this->assertSame('', $client->getLastResponseContentType()); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testGetLastResponseBodyIsInitialEmpty() { $client = new NativeCurlClient( @@ -102,9 +90,6 @@ public function testGetLastResponseBodyIsInitialEmpty() $this->assertSame('', $client->getLastResponseBody()); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testStartAndStopImpersonateUser() { $expectedOptions = [ @@ -161,9 +146,6 @@ public function testStartAndStopImpersonateUser() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetSslVersion() { $expectedOptions = [ @@ -219,9 +201,6 @@ public function testSetSslVersion() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetSslVerifypeer() { $expectedOptions = [ @@ -278,9 +257,6 @@ public function testSetSslVerifypeer() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetSslVerifyhost() { $expectedOptions = [ @@ -337,9 +313,6 @@ public function testSetSslVerifyhost() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetCustomHttpHeaders() { $expectedOptions = [ @@ -402,9 +375,6 @@ public function testSetCustomHttpHeaders() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetCustomHost() { $expectedOptions = [ @@ -463,9 +433,6 @@ public function testSetCustomHost() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testSetPort() { $expectedOptions = [ @@ -521,9 +488,6 @@ public function testSetPort() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testCustomPortWillSetFromSchema() { $expectedOptions = [ @@ -574,9 +538,6 @@ public function testCustomPortWillSetFromSchema() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testCustomPortWillSetFromUrl() { $expectedOptions = [ @@ -628,7 +589,6 @@ public function testCustomPortWillSetFromUrl() } /** - * @covers \Redmine\Client\NativeCurlClient * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] @@ -692,9 +652,6 @@ public static function getRequestReponseData(): array ]; } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testHandlingOfResponseWithoutContent() { $content = ''; @@ -733,9 +690,6 @@ public function testHandlingOfResponseWithoutContent() $this->assertSame($content, $client->getLastResponseBody()); } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testCurlErrorThrowsException() { $curl = $this->createMock(stdClass::class); @@ -768,14 +722,10 @@ public function testCurlErrorThrowsException() } /** - * @covers \Redmine\Client\NativeCurlClient - * - * @param string $apiName - * @param string $class * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function testGetApiShouldReturnApiInstance($apiName, $class) + public function testGetApiShouldReturnApiInstance(string $apiName, string $class) { $client = new NativeCurlClient( 'http://test.local', @@ -810,9 +760,6 @@ public static function getApiClassesProvider(): array ]; } - /** - * @covers \Redmine\Client\NativeCurlClient - */ public function testGetApiShouldThrowException() { $client = new NativeCurlClient( diff --git a/tests/Unit/Client/Psr18Client/RequestTest.php b/tests/Unit/Client/Psr18Client/RequestTest.php index 92669f05..44d684ed 100644 --- a/tests/Unit/Client/Psr18Client/RequestTest.php +++ b/tests/Unit/Client/Psr18Client/RequestTest.php @@ -3,6 +3,7 @@ namespace Redmine\Tests\Unit\Client\Psr18ClientTest; use Exception; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientExceptionInterface; @@ -17,11 +18,7 @@ use Redmine\Http\Request; use Redmine\Http\Response; -/** - * @covers \Redmine\Client\Psr18Client::request - * @covers \Redmine\Client\Psr18Client::runRequest - * @covers \Redmine\Client\Psr18Client::createRequest - */ +#[CoversClass(Psr18Client::class)] class RequestTest extends TestCase { /** diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index 625ed56d..0bd722f8 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -4,6 +4,7 @@ use Exception; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; @@ -19,11 +20,9 @@ use Redmine\Http\HttpClient; use stdClass; +#[CoversClass(Psr18Client::class)] class Psr18ClientTest extends TestCase { - /** - * @covers \Redmine\Client\Psr18Client - */ public function testShouldPassApiKeyToConstructor() { $client = new Psr18Client( @@ -39,9 +38,6 @@ public function testShouldPassApiKeyToConstructor() $this->assertInstanceOf(HttpClient::class, $client); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testServerRequestFactoryIsAcceptedInConstructorForBC() { $client = new Psr18Client( @@ -66,9 +62,6 @@ public function testServerRequestFactoryIsAcceptedInConstructorForBC() $client->requestGet('/path.xml'); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testShouldPassUsernameAndPasswordToConstructor() { $client = new Psr18Client( @@ -84,9 +77,6 @@ public function testShouldPassUsernameAndPasswordToConstructor() $this->assertInstanceOf(Client::class, $client); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testGetLastResponseStatusCodeIsInitialZero() { $client = new Psr18Client( @@ -100,9 +90,6 @@ public function testGetLastResponseStatusCodeIsInitialZero() $this->assertSame(0, $client->getLastResponseStatusCode()); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testGetLastResponseContentTypeIsInitialEmpty() { $client = new Psr18Client( @@ -116,9 +103,6 @@ public function testGetLastResponseContentTypeIsInitialEmpty() $this->assertSame('', $client->getLastResponseContentType()); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testGetLastResponseBodyIsInitialEmpty() { $client = new Psr18Client( @@ -132,9 +116,6 @@ public function testGetLastResponseBodyIsInitialEmpty() $this->assertSame('', $client->getLastResponseBody()); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testStartAndStopImpersonateUser() { $request = $this->createMock(RequestInterface::class); @@ -165,9 +146,6 @@ public function testStartAndStopImpersonateUser() $client->requestGet('/path'); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testRequestGetReturnsFalse() { $response = $this->createMock(ResponseInterface::class); @@ -194,7 +172,6 @@ public function testRequestGetReturnsFalse() } /** - * @covers \Redmine\Client\Psr18Client * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] @@ -259,14 +236,10 @@ public static function getRequestReponseData(): array } /** - * @covers \Redmine\Client\Psr18Client - * - * @param string $apiName - * @param string $class * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function testGetApiShouldReturnApiInstance($apiName, $class) + public function testGetApiShouldReturnApiInstance(string $apiName, string $class) { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -304,9 +277,6 @@ public static function getApiClassesProvider(): array ]; } - /** - * @covers \Redmine\Client\Psr18Client::__construct - */ public function testCreateWithoutFactoryThrowsException() { $this->expectException(Exception::class); @@ -322,9 +292,6 @@ public function testCreateWithoutFactoryThrowsException() ); } - /** - * @covers \Redmine\Client\Psr18Client - */ public function testGetApiShouldThrowException() { $client = new Psr18Client( diff --git a/tests/Unit/Exception/ClientExceptionTest.php b/tests/Unit/Exception/ClientExceptionTest.php index 200e0941..6857a73d 100644 --- a/tests/Unit/Exception/ClientExceptionTest.php +++ b/tests/Unit/Exception/ClientExceptionTest.php @@ -3,13 +3,12 @@ namespace Redmine\Tests\Unit\Exception; use Exception; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Exception as RedmineException; use Redmine\Exception\ClientException; -/** - * @coversDefaultClass \Redmine\Exception\ClientException - */ +#[CoversClass(ClientException::class)] class ClientExceptionTest extends TestCase { public function testClientException() diff --git a/tests/Unit/Exception/InvalidApiNameExceptionTest.php b/tests/Unit/Exception/InvalidApiNameExceptionTest.php index 9078d8a3..4df5bba3 100644 --- a/tests/Unit/Exception/InvalidApiNameExceptionTest.php +++ b/tests/Unit/Exception/InvalidApiNameExceptionTest.php @@ -3,13 +3,12 @@ namespace Redmine\Tests\Unit\Exception; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Exception as RedmineException; use Redmine\Exception\InvalidApiNameException; -/** - * @coversDefaultClass \Redmine\Exception\InvalidApiNameException - */ +#[CoversClass(InvalidApiNameException::class)] class InvalidApiNameExceptionTest extends TestCase { public function testInvalidApiNameException() diff --git a/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php b/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php index 9e97bbbb..155866fc 100644 --- a/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Http\HttpFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Http\HttpFactory; use Redmine\Http\Request; -/** - * @covers \Redmine\Http\HttpFactory::makeJsonRequest - */ +#[CoversClass(HttpFactory::class)] class MakeJsonRequestTest extends TestCase { public function testMakeJsonRequest() diff --git a/tests/Unit/Http/HttpFactory/MakeRequestTest.php b/tests/Unit/Http/HttpFactory/MakeRequestTest.php index 80c728ee..e3e9cdfd 100644 --- a/tests/Unit/Http/HttpFactory/MakeRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeRequestTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Http\HttpFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Http\HttpFactory; use Redmine\Http\Request; -/** - * @covers \Redmine\Http\HttpFactory::makeRequest - */ +#[CoversClass(HttpFactory::class)] class MakeRequestTest extends TestCase { public function testMakeRequest() diff --git a/tests/Unit/Http/HttpFactory/MakeResponseTest.php b/tests/Unit/Http/HttpFactory/MakeResponseTest.php index 407b90ec..d54ddf04 100644 --- a/tests/Unit/Http/HttpFactory/MakeResponseTest.php +++ b/tests/Unit/Http/HttpFactory/MakeResponseTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Http\HttpFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Http\HttpFactory; use Redmine\Http\Response; -/** - * @covers \Redmine\Http\HttpFactory::makeResponse - */ +#[CoversClass(HttpFactory::class)] class MakeResponseTest extends TestCase { public function testMakeResponse() diff --git a/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php b/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php index 5a0bf923..b11adf4d 100644 --- a/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Http\HttpFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Redmine\Http\HttpFactory; use Redmine\Http\Request; -/** - * @covers \Redmine\Http\HttpFactory::makeXmlRequest - */ +#[CoversClass(HttpFactory::class)] class MakeXmlRequestTest extends TestCase { public function testMakeXmlRequest() diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 65db3f8e..1b9d5a93 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -4,14 +4,13 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Exception\SerializerException; use Redmine\Serializer\JsonSerializer; -/** - * @coversDefaultClass \Redmine\Serializer\JsonSerializer - */ +#[CoversClass(JsonSerializer::class)] class JsonSerializerTest extends TestCase { public static function getEncodedToNormalizedData(): array diff --git a/tests/Unit/Serializer/PathSerializerTest.php b/tests/Unit/Serializer/PathSerializerTest.php index 17a9c2d3..ec6292fd 100644 --- a/tests/Unit/Serializer/PathSerializerTest.php +++ b/tests/Unit/Serializer/PathSerializerTest.php @@ -4,13 +4,12 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Serializer\PathSerializer; -/** - * @coversDefaultClass \Redmine\Serializer\PathSerializer - */ +#[CoversClass(PathSerializer::class)] class PathSerializerTest extends TestCase { public static function getPathData(): array diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index b796cffa..09f9bdd9 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -4,14 +4,13 @@ namespace Redmine\Tests\Unit\Serializer; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Redmine\Exception\SerializerException; use Redmine\Serializer\XmlSerializer; -/** - * @coversDefaultClass \Redmine\Serializer\XmlSerializer - */ +#[CoversClass(XmlSerializer::class)] class XmlSerializerTest extends TestCase { /** From fcf3bec2db5224f6d154f3328dfba8668bd83529 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 12 Mar 2024 11:58:53 +0100 Subject: [PATCH 13/14] Fix code style --- tests/Unit/Api/AttachmentTest.php | 2 +- tests/Unit/Client/NativeCurlClientTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index 1b49cbca..321950ba 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -11,7 +11,7 @@ /** * @author Malte Gerth */ - #[CoversClass(Attachment::class)] +#[CoversClass(Attachment::class)] class AttachmentTest extends TestCase { /** diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index f5004348..32af6d89 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -15,7 +15,6 @@ use Redmine\Http\HttpClient; use stdClass; - #[CoversClass(NativeCurlClient::class)] class NativeCurlClientTest extends TestCase { From a1b6e3a146ebb7c891432f5281f779e16f582668 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 12 Mar 2024 12:34:20 +0100 Subject: [PATCH 14/14] Remove support for PHPUnit 11 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cdc487ce..01382ecd 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "guzzlehttp/psr7": "^2", "php-mock/php-mock-phpunit": "^2.6", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5 || ^10.5 || ^11.0" + "phpunit/phpunit": "^9.5 || ^10.5" }, "autoload": { "psr-4": {