Skip to content

Commit

Permalink
bump: PHPQA with CS Fixer fully supporting PHPUnit attributes (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarlovi authored May 31, 2024
1 parent e331b5c commit dc278dd
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 39 deletions.
2 changes: 1 addition & 1 deletion resources/Lighthouse/common.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion resources/PHP/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion resources/PHP/php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down Expand Up @@ -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' => [
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/Common/DefaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class DefaultTest extends MakefileTestCase
{
protected function getExpectedInitPaths(): array
Expand Down
11 changes: 5 additions & 6 deletions tests/functional/MakefileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down Expand Up @@ -107,11 +105,10 @@ public function testMakefileHasInit(): void
}

/**
* @dataProvider provideMakefileCommandsWorkCases
*
* @param list<string> $expected
* @param array<string, string> $env
*/
#[\PHPUnit\Framework\Attributes\DataProvider('provideMakefileCommandsWorkCases')]
public function testMakefileCommandsWork(string $command, array $expected, array $env): void
{
$actual = self::dryRun($command, env: $env);
Expand Down Expand Up @@ -205,6 +202,8 @@ protected static function generatePermissionsExecutionPath(array $dirs): array

/**
* @return iterable<array-key, array{string, list<string>, array<string, string>}>
*
* @psalm-suppress PossiblyUnusedMethod false positive
*/
public static function provideMakefileCommandsWorkCases(): iterable
{
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/PHP/LibraryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class LibraryTest extends MakefileTestCase
{
use PhpTrait;
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/PHP/PharTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class PharTest extends MakefileTestCase
{
use PhpTrait;
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/PHP/PhpTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/Pimcore/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class ApplicationTest extends MakefileTestCase
{
use PhpTrait;
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/Pimcore/LibraryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class LibraryTest extends MakefileTestCase
{
use PhpTrait;
Expand Down
8 changes: 3 additions & 5 deletions tests/functional/YASSG/CompatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class CompatTest extends MakefileTestCase
{
use PhpTrait;
Expand Down Expand Up @@ -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()
);
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/YASSG/DefaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

/**
* @internal
*
* @coversNothing
*
* @medium
*/
#[\PHPUnit\Framework\Attributes\CoversNothing]
#[\PHPUnit\Framework\Attributes\Medium]
final class DefaultTest extends MakefileTestCase
{
use PhpTrait;
Expand Down

0 comments on commit dc278dd

Please sign in to comment.