Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: PHPUnit - allow for v10 #7606

Merged
merged 7 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/composite-actions/setup-php-with-composer-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,7 @@ runs:
shell: bash
run: composer config extra.symfony.require ${{ inputs.composer-flex-with-symfony-version }}

- name: Configure Symfony ^7
if: inputs.composer-flex-with-symfony-version == '^7'
shell: bash
run: |
composer remove facile-it/paraunit --dev --no-update

- name: Install Composer deps
uses: ./.github/composite-actions/install-composer-deps
with:
flags: ${{ inputs.composer-flags }}

- name: Mock ParaUnit under Symfony ^7
if: inputs.composer-flex-with-symfony-version == '^7'
shell: bash
run: |
echo '#!/usr/bin/env bash' > vendor/bin/paraunit
echo 'set -eu' >> vendor/bin/paraunit
echo 'shift' >> vendor/bin/paraunit
echo './vendor/bin/phpunit "${@}"' >> vendor/bin/paraunit
chmod +x vendor/bin/paraunit
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ jobs:
if: matrix.collect-code-coverage == 'yes'
run: sed 's/enforceTimeLimit="true"/enforceTimeLimit="false"/g' phpunit.xml.dist > phpunit.xml

- name: Disable time limit for tests under Windows # due to https://github.com/sebastianbergmann/phpunit/issues/5589
if: matrix.operating-system == 'windows-latest'
run: (Get-Content phpunit.xml.dist) -replace 'enforceTimeLimit="true"', 'enforceTimeLimit="false"' | Out-File phpunit.xml

- name: Run tests
if: matrix.run-tests == 'yes' && matrix.collect-code-coverage != 'yes'
env:
Expand All @@ -184,7 +188,7 @@ jobs:
if: matrix.run-tests == 'yes' && matrix.collect-code-coverage == 'yes'
env:
FAST_LINT_TEST_CASES: 1
run: vendor/bin/paraunit coverage --testsuite unit --exclude-group covers-nothing --clover build/logs/clover.xml
run: vendor/bin/paraunit coverage --testsuite unit --pass-through=--exclude-group=covers-nothing --clover=build/logs/clover.xml

- name: Upload coverage results to Coveralls
if: matrix.run-tests == 'yes' && matrix.collect-code-coverage == 'yes'
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^9.6 || ^10.5.5",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"suggest": {
Expand Down Expand Up @@ -124,7 +124,7 @@
],
"test:coverage": [
"Composer\\Config::disableProcessTimeout",
"paraunit coverage --testsuite unit --exclude-group covers-nothing"
"@composer show facile-it/paraunit ^2 && (paraunit coverage --testsuite unit --pass-through=--exclude-group=covers-nothing) || (paraunit coverage --testsuite unit --exclude-group covers-nothing)"
],
"test:integration": [
"Composer\\Config::disableProcessTimeout",
Expand Down
50 changes: 50 additions & 0 deletions dev-tools/phpstan/baseline.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
<?php declare(strict_types = 1);

$ignoreErrors = [];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\CheckCommand\\:\\:\\$defaultDescription has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/CheckCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\CheckCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/CheckCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\DescribeCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/DescribeCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\DocumentationCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/DocumentationCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\FixCommand\\:\\:\\$defaultDescription has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/FixCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\FixCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/FixCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\HelpCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/HelpCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\ListFilesCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/ListFilesCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\ListSetsCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/ListSetsCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Property PhpCsFixer\\\\Console\\\\Command\\\\SelfUpdateCommand\\:\\:\\$defaultName has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/SelfUpdateCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
</include>
</coverage>

<extensions>
<bootstrap class="Paraunit\Configuration\ParaunitExtension"/>
</extensions>

<php>
<ini name="zend.enable_gc" value="0"/>
<ini name="memory_limit" value="10G"/>
Expand Down
2 changes: 1 addition & 1 deletion tests/PregTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testPatternValidation(string $pattern, ?bool $expected = null, ?
$this->expectExceptionMessageMatches($expectedMessage);
}

return (bool) $i;
return 0 !== $i;
};

try {
Expand Down