From af77b15736ceb094825d08b0434ffd494f1fc282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Thu, 12 Dec 2024 10:27:32 +0100 Subject: [PATCH 1/2] [TASK] Ensure failing `php-cs-fixer` within Github Action pipeline This change adds the dry-run flag (`-n`) to the php-cs-fixer code-quality execution within the Github Action workflow file to emit an non-zero exit code when changes are detected to ensure failing job-run in this case. --- .github/workflows/testcore12.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testcore12.yml b/.github/workflows/testcore12.yml index c4050478..522f2bd1 100644 --- a/.github/workflows/testcore12.yml +++ b/.github/workflows/testcore12.yml @@ -53,7 +53,7 @@ jobs: run: "Build/Scripts/runTests.sh -t 12 -p ${{ matrix.php-version }} -s lintPhp" - name: "Validate CGL" - run: "Build/Scripts/runTests.sh -t 12 -p ${{ matrix.php-version }} -s cgl" + run: "Build/Scripts/runTests.sh -t 12 -p ${{ matrix.php-version }} -s cgl -n" - name: "Ensure tests methods do not start with \"test\"" run: "Build/Scripts/runTests.sh -t 12 -p ${{ matrix.php-version }} -s checkTestMethodsPrefix" From d73fd9ecefed2709c9227f2a011024383fac8d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Thu, 12 Dec 2024 10:31:43 +0100 Subject: [PATCH 2/2] [TASK] Apply php-cs-fixer changes This change applies `php-cs-fixer` modifications which slipped into the code-base because the corresponding code-quality check missed the dry-run flag and doesn't fail when changes has been detected. --- Tests/Functional/AbstractDeepLTestCase.php | 4 ++-- Tests/Functional/ClientTest.php | 6 +++--- Tests/Functional/Services/DeeplServiceTest.php | 2 +- Tests/Functional/Services/UsageServiceTest.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/Functional/AbstractDeepLTestCase.php b/Tests/Functional/AbstractDeepLTestCase.php index b7247fa6..c2222129 100644 --- a/Tests/Functional/AbstractDeepLTestCase.php +++ b/Tests/Functional/AbstractDeepLTestCase.php @@ -4,14 +4,14 @@ namespace WebVision\Deepltranslate\Core\Tests\Functional; -use RuntimeException; use Closure; -use Exception; use DeepL\Translator; use DeepL\TranslatorOptions; +use Exception; use phpmock\phpunit\PHPMock; use Psr\Log\NullLogger; use Ramsey\Uuid\Uuid; +use RuntimeException; use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; diff --git a/Tests/Functional/ClientTest.php b/Tests/Functional/ClientTest.php index f73bdc2f..39c6d7d6 100644 --- a/Tests/Functional/ClientTest.php +++ b/Tests/Functional/ClientTest.php @@ -4,9 +4,6 @@ namespace WebVision\Deepltranslate\Core\Tests\Functional; -use PHPUnit\Framework\Attributes\CoversClass; -use WebVision\Deepltranslate\Core\Client; -use PHPUnit\Framework\Attributes\Test; use DateTime; use DeepL\GlossaryEntries; use DeepL\GlossaryInfo; @@ -14,6 +11,9 @@ use DeepL\Language; use DeepL\TextResult; use Helmich\JsonAssert\JsonAssertions; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; +use WebVision\Deepltranslate\Core\Client; use WebVision\Deepltranslate\Core\ClientInterface; #[CoversClass(Client::class)] diff --git a/Tests/Functional/Services/DeeplServiceTest.php b/Tests/Functional/Services/DeeplServiceTest.php index a656b053..b93bfe90 100644 --- a/Tests/Functional/Services/DeeplServiceTest.php +++ b/Tests/Functional/Services/DeeplServiceTest.php @@ -4,9 +4,9 @@ namespace WebVision\Deepltranslate\Core\Tests\Functional\Services; +use DeepL\Language; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use DeepL\Language; use WebVision\Deepltranslate\Core\Domain\Dto\TranslateContext; use WebVision\Deepltranslate\Core\Service\DeeplService; use WebVision\Deepltranslate\Core\Service\ProcessingInstruction; diff --git a/Tests/Functional/Services/UsageServiceTest.php b/Tests/Functional/Services/UsageServiceTest.php index ec72e9a9..db040d91 100644 --- a/Tests/Functional/Services/UsageServiceTest.php +++ b/Tests/Functional/Services/UsageServiceTest.php @@ -4,9 +4,9 @@ namespace WebVision\Deepltranslate\Core\Tests\Functional\Services; -use PHPUnit\Framework\Attributes\Test; use DeepL\Usage; use DeepL\UsageDetail; +use PHPUnit\Framework\Attributes\Test; use WebVision\Deepltranslate\Core\Service\DeeplService; use WebVision\Deepltranslate\Core\Service\ProcessingInstruction; use WebVision\Deepltranslate\Core\Service\UsageService;