From dc278dd9818e7816aa32bacc339617e8a1930f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Fri, 31 May 2024 15:31:01 +0200 Subject: [PATCH] bump: PHPQA with CS Fixer fully supporting PHPUnit attributes (#162) --- resources/Lighthouse/common.mk | 2 +- resources/PHP/common.mk | 2 +- resources/PHP/php-cs-fixer.php | 4 +++- tests/functional/Common/DefaultTest.php | 6 ++---- tests/functional/MakefileTestCase.php | 11 +++++------ tests/functional/PHP/LibraryTest.php | 6 ++---- tests/functional/PHP/PharTest.php | 6 ++---- tests/functional/PHP/PhpTrait.php | 2 +- tests/functional/Pimcore/ApplicationTest.php | 6 ++---- tests/functional/Pimcore/LibraryTest.php | 6 ++---- tests/functional/YASSG/CompatTest.php | 8 +++----- tests/functional/YASSG/DefaultTest.php | 6 ++---- 12 files changed, 26 insertions(+), 39 deletions(-) diff --git a/resources/Lighthouse/common.mk b/resources/Lighthouse/common.mk index c25f9a0..7b30af3 100644 --- a/resources/Lighthouse/common.mk +++ b/resources/Lighthouse/common.mk @@ -1,4 +1,4 @@ -LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.12.2-chrome-124.0.6367.60-1-ff-125.0.1-edge-124.0.2478.51-1 +LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1 LIGHTHOUSE_DOCKER_COMMAND ?= docker run --init --interactive ${DOCKER_TTY} --rm --env HOME=/tmp ${DOCKER_USER} --volume "${DOCKER_CWD}:/public" --workdir "/public" ${LIGHTHOUSE_DOCKER_IMAGE} analyze/lighthouse: ## Analyze built files using Lighthouse diff --git a/resources/PHP/common.mk b/resources/PHP/common.mk index 1a28d1e..75c579f 100644 --- a/resources/PHP/common.mk +++ b/resources/PHP/common.mk @@ -8,7 +8,7 @@ PHP_VERSION=8.3 endif ifndef PHPQA_DOCKER_IMAGE -PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.97.0-php${PHP_VERSION}-alpine +PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.97.3-php${PHP_VERSION}-alpine endif ifndef PHPQA_DOCKER_COMMAND diff --git a/resources/PHP/php-cs-fixer.php b/resources/PHP/php-cs-fixer.php index 8ceb1e6..a4ca00f 100644 --- a/resources/PHP/php-cs-fixer.php +++ b/resources/PHP/php-cs-fixer.php @@ -19,8 +19,9 @@ ->exclude('vendor') ->in($root); - return (new Config()) + return (new Config('sigwin/infra')) ->setCacheFile($root.'/var/phpqa/php-cs-fixer.cache') + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setRiskyAllowed(true) ->setRules( [ @@ -49,6 +50,7 @@ 'not_operator_with_successor_space' => true, 'nullable_type_declaration_for_default_null_value' => true, 'ordered_interfaces' => true, + 'php_unit_attributes' => true, 'php_unit_internal_class' => true, 'php_unit_size_class' => true, 'phpdoc_order_by_value' => ['annotations' => [ diff --git a/tests/functional/Common/DefaultTest.php b/tests/functional/Common/DefaultTest.php index aa86a30..824c69a 100644 --- a/tests/functional/Common/DefaultTest.php +++ b/tests/functional/Common/DefaultTest.php @@ -17,11 +17,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class DefaultTest extends MakefileTestCase { protected function getExpectedInitPaths(): array diff --git a/tests/functional/MakefileTestCase.php b/tests/functional/MakefileTestCase.php index 295de8f..44b0ad6 100644 --- a/tests/functional/MakefileTestCase.php +++ b/tests/functional/MakefileTestCase.php @@ -18,12 +18,10 @@ use Symfony\Component\Process\Process; /** - * @coversNothing - * * @internal - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] abstract class MakefileTestCase extends TestCase { /** @@ -107,11 +105,10 @@ public function testMakefileHasInit(): void } /** - * @dataProvider provideMakefileCommandsWorkCases - * * @param list $expected * @param array $env */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMakefileCommandsWorkCases')] public function testMakefileCommandsWork(string $command, array $expected, array $env): void { $actual = self::dryRun($command, env: $env); @@ -205,6 +202,8 @@ protected static function generatePermissionsExecutionPath(array $dirs): array /** * @return iterable, array}> + * + * @psalm-suppress PossiblyUnusedMethod false positive */ public static function provideMakefileCommandsWorkCases(): iterable { diff --git a/tests/functional/PHP/LibraryTest.php b/tests/functional/PHP/LibraryTest.php index 214339a..060a6fb 100644 --- a/tests/functional/PHP/LibraryTest.php +++ b/tests/functional/PHP/LibraryTest.php @@ -17,11 +17,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class LibraryTest extends MakefileTestCase { use PhpTrait; diff --git a/tests/functional/PHP/PharTest.php b/tests/functional/PHP/PharTest.php index 77f8490..2a7701c 100644 --- a/tests/functional/PHP/PharTest.php +++ b/tests/functional/PHP/PharTest.php @@ -17,11 +17,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class PharTest extends MakefileTestCase { use PhpTrait; diff --git a/tests/functional/PHP/PhpTrait.php b/tests/functional/PHP/PhpTrait.php index c656b04..583c3af 100644 --- a/tests/functional/PHP/PhpTrait.php +++ b/tests/functional/PHP/PhpTrait.php @@ -69,7 +69,7 @@ private static function paths(?array $env): array { // defaults which are also defined in the Makefile $phpVersion = $env['PHP_VERSION'] ?? '8.3'; - $phpqaDockerImage = $env['PHPQA_DOCKER_IMAGE'] ?? 'jakzal/phpqa:1.97.0-php%1$s-alpine'; + $phpqaDockerImage = $env['PHPQA_DOCKER_IMAGE'] ?? 'jakzal/phpqa:1.97.3-php%1$s-alpine'; $dockerEnv = $env['DOCKER_ENV'] ?? ' '; return [ diff --git a/tests/functional/Pimcore/ApplicationTest.php b/tests/functional/Pimcore/ApplicationTest.php index 3abc277..189195e 100644 --- a/tests/functional/Pimcore/ApplicationTest.php +++ b/tests/functional/Pimcore/ApplicationTest.php @@ -19,11 +19,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class ApplicationTest extends MakefileTestCase { use PhpTrait; diff --git a/tests/functional/Pimcore/LibraryTest.php b/tests/functional/Pimcore/LibraryTest.php index 4e65858..91fb596 100644 --- a/tests/functional/Pimcore/LibraryTest.php +++ b/tests/functional/Pimcore/LibraryTest.php @@ -18,11 +18,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class LibraryTest extends MakefileTestCase { use PhpTrait; diff --git a/tests/functional/YASSG/CompatTest.php b/tests/functional/YASSG/CompatTest.php index 3485b92..4fb315c 100644 --- a/tests/functional/YASSG/CompatTest.php +++ b/tests/functional/YASSG/CompatTest.php @@ -18,11 +18,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class CompatTest extends MakefileTestCase { use PhpTrait; @@ -130,7 +128,7 @@ private static function generateDockerBackstopExecutionPath(string $command): st private static function generateDockerLighthouseExecutionPath(string $command): string { return sprintf( - 'docker run --init --interactive --rm --env HOME=/tmp %2$s --volume "$ROOT:/public" --workdir "/public" cypress/browsers:node-20.12.2-chrome-124.0.6367.60-1-ff-125.0.1-edge-124.0.2478.51-1 %1$s', + 'docker run --init --interactive --rm --env HOME=/tmp %2$s --volume "$ROOT:/public" --workdir "/public" cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1 %1$s', $command, self::generateDockerComposeExecutionUser() ); diff --git a/tests/functional/YASSG/DefaultTest.php b/tests/functional/YASSG/DefaultTest.php index 865bc48..d26db57 100644 --- a/tests/functional/YASSG/DefaultTest.php +++ b/tests/functional/YASSG/DefaultTest.php @@ -18,11 +18,9 @@ /** * @internal - * - * @coversNothing - * - * @medium */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Medium] final class DefaultTest extends MakefileTestCase { use PhpTrait;