Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,57 @@ concurrency:

jobs:
tests:
name: "Tests"
name: "Tests PHPUnit 12.x"
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
operating-system: [ ubuntu-latest, windows-latest ]

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl
extensions: ds,mbstring
ini-file: development
ini-values: memory_limit=-1

- name: "Upgrade PHPUnit 12"
shell: bash
run: |
composer require --dev phpunit/phpunit:^12 brianium/paratest:^7.16 symfony/process:^7 symfony/string:^7 symfony/console:^7 --update-with-dependencies --ignore-platform-reqs --working-dir=tests
composer require --dev phpunit/phpunit:^12 sebastian/diff --update-with-dependencies --ignore-platform-reqs

- name: "Check PHP configuration"
run: "vendor/bin/phpunit --check-php-configuration"

- name: "Tests"
run: "php tests/vendor/bin/paratest --runner WrapperRunner --no-coverage"
Copy link
Contributor Author

@staabm staabm Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to call paratest directly, instead of using make tests which would trigger composer install --working-dir tests, and this errors because of platform-requirement problems with:

composer install --working-dir tests
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - brianium/paratest is locked to version v7.16.0 and an update of this package was not requested.
    - brianium/paratest v7.16.0 requires php ~8.3.0 || ~8.4.0 || ~8.5.0 -> your php version (8.2.99; overridden via config.platform, actual: 8.3.28) does not satisfy that requirement.
  Problem 2
    - phpunit/php-code-coverage is locked to version 12.5.1 and an update of this package was not requested.
    - phpunit/php-code-coverage 12.5.1 requires php >=8.3 -> your php version (8.2.99; overridden via config.platform, actual: 8.3.28) does not satisfy that requirement.

see https://github.com/phpstan/phpstan-src/actions/runs/20089728006/job/57634537245?pr=4624


in case this is fine, I think I can remove the symfony/* packages again from
composer require --dev phpunit/phpunit:^12 brianium/paratest:^7.16 symfony/process:^7 symfony/string:^7 symfony/console:^7 --update-with-dependencies --ignore-platform-reqs --working-dir=tests


tests-phpunit11:
name: "Tests PHPUnit 11.x"
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
operating-system: [ ubuntu-latest, windows-latest ]

steps:
- name: "Checkout"
uses: actions/checkout@v4
Expand Down Expand Up @@ -208,7 +245,6 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
operating-system: [ubuntu-latest]
Expand All @@ -227,14 +263,20 @@ jobs:
- uses: ./build-infection/.github/actions/setup-php
with:
php-version: "${{ matrix.php-version }}"
extensions: ds,mbstring
php-extensions: ds,mbstring

- uses: "ramsey/composer-install@v3"

- uses: "ramsey/composer-install@v3"
with:
working-directory: "tests/"

- name: "Upgrade PHPUnit with Paratest to speedup coverage generation"
shell: bash
run: |
composer require --dev phpunit/phpunit:^12 brianium/paratest:^7.16 symfony/process:^7 symfony/string:^7 symfony/console:^7 --update-with-dependencies --ignore-platform-reqs --working-dir=tests
composer require --dev phpunit/phpunit:^12 sebastian/diff --update-with-dependencies --ignore-platform-reqs

- uses: "ramsey/composer-install@v3"
with:
working-directory: "build-infection/"
Expand Down Expand Up @@ -266,6 +308,7 @@ jobs:
php -d pcov.enabled=1 tests/vendor/bin/paratest \
--passthru-php="'-d' 'pcov.enabled=1'" \
--coverage-xml=tmp/coverage/coverage-xml --log-junit=tmp/coverage/junit.xml
--exclude-source-from-xml-coverage

- name: "Run infection"
run: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"react/promise": "^3.2",
"react/socket": "^1.3",
"react/stream": "^1.1",
"sebastian/diff": "^6.0.2",
"sebastian/diff": "^6.0.2 || ^7",
"symfony/console": "^5.4.3",
"symfony/finder": "^5.4.3",
"symfony/polyfill-intl-grapheme": "^1.23",
Expand Down
15 changes: 8 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" executionOrder="random" failOnRisky="true" failOnWarning="true" failOnEmptyTestSuite="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" cacheDirectory="tmp/.phpunit.cache" beStrictAboutCoverageMetadata="true" displayDetailsOnPhpunitDeprecations="true" displayDetailsOnIncompleteTests="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" executionOrder="random" failOnRisky="true" failOnWarning="true" failOnPhpunitWarning="false" failOnEmptyTestSuite="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" cacheDirectory="tmp/.phpunit.cache" beStrictAboutCoverageMetadata="true" displayDetailsOnPhpunitDeprecations="true" displayDetailsOnIncompleteTests="true">
Copy link
Contributor Author

@staabm staabm Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled exit-code=1 on phpunit warnings because we currently get warnings like

1) PHPStan\Analyser\LegacyNodeScopeResolverTest::testTypeFromMethodPhpDocs
* Data set #5 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #9 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #18 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #19 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #5 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #9 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #18 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

* Data set #19 provided by PHPStan\Analyser\LegacyNodeScopeResolverTest::dataTypeFromMethodPhpDocs has more arguments (3) than the test method accepts (2)

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php:3764

2) PHPStan\Rules\Methods\OverridingMethodRuleTest::testOverridingFinalMethod
* Data set #0 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (2)

* Data set #1 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (2)

* Data set #0 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (2)

* Data set #1 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (2)

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php:59

3) PHPStan\Rules\Methods\OverridingMethodRuleTest::testBug3403
* Data set #0 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (1)

* Data set #1 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (1)

* Data set #0 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (1)

* Data set #1 provided by PHPStan\Rules\Methods\OverridingMethodRuleTest::dataOverridingFinalMethod has more arguments (3) than the test method accepts (1)

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php:325

which we cannot ignore using validateArgumentCount #[DataProvider] parameter because this parameter doesn't exist on PHPUnit 11.x:

XDEBUG_MODE=off php tests/vendor/bin/paratest --runner WrapperRunner --no-coverage
ParaTest v7.8.4 upon PHPUnit 11.5.45 by Sebastian Bergmann and contributors.
In AttributeParser.php line 421:
                                                                               
  Invalid attribute PHPUnit\Framework\Attributes\DataProvider for method PHPS  
  tan\Rules\Methods\OverridingMethodRuleTest::testOverridingFinalMethod() in   
  /home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Rules/Methods/Overr  
  idingMethodRuleTest.php:59                                                   
  Unknown named parameter $validateArgumentCount                               
                                                                               
paratest [--functional] [-m|--max-batch-size MAX-BATCH-SIZE] [--no-test-tokens] [--passthru-php PASSTHRU-PHP] [-p|--processes PROCESSES] [--runner RUNNER] [--tmp-dir TMP-DIR] [-v|--verbose] [--bootstrap BOOTSTRAP] [-c|--configuration CONFIGURATION] [--no-configuration] [--cache-directory CACHE-DIRECTORY] [--testsuite TESTSUITE] [--exclude-testsuite EXCLUDE-TESTSUITE] [--group GROUP] [--exclude-group EXCLUDE-GROUP] [--filter FILTER] [--process-isolation] [--strict-coverage] [--strict-global-state] [--disallow-test-output] [--dont-report-useless-tests] [--stop-on-defect] [--stop-on-error] [--stop-on-failure] [--stop-on-warning] [--stop-on-risky] [--stop-on-skipped] [--stop-on-incomplete] [--fail-on-incomplete] [--fail-on-risky] [--fail-on-skipped] [--fail-on-warning] [--fail-on-deprecation] [--order-by ORDER-BY] [--random-order-seed RANDOM-ORDER-SEED] [--colors [COLORS]] [--no-progress] [--display-incomplete] [--display-skipped] [--display-deprecations] [--display-errors] [--display-notices] [--display-warnings
make: *** [Makefile:6: tests] Error 1
Error: Process completed with exit code 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we could drop the validateArgumentCount parameter in the downgrading process

<extensions>
<bootstrap class="PHPStan\Testing\PHPUnit\PHPStanPHPUnitExtension"/>
</extensions>
Expand Down
Loading