-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
run tests using PHPUnit 11.5 #58370
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
run tests using PHPUnit 11.5 #58370
Conversation
The PR cannot be merged at the moment as it is based on a bunch of other open pull requests that are paving the way to be able to actually run the tests with PHPUnit 11. |
7178ae5
to
76245c5
Compare
This is super nice news! Did you already take care of everything required to be "PHPUnit 11 compliant" in already opened PRs ? |
@alexandre-daubois The "ensure session storages are opened before destroying them" commit is the only one that is not already part of an open PR. I do not really understand yet why that change is necessary (the flow in |
76245c5
to
24d86e8
Compare
This PR was merged into the 5.4 branch. Discussion ---------- Tweak error/exception handler registration | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53812 | License | MIT This should allow removing the custom bootstrap file from #58370 /cc `@xabbuh` The change on FrameworkBundle leads to a tweaked behavior: we don't override the previous error handler in case it's not the Symfony one. This shouldn't change anything in practice since the error handler is already registered by the runtime component. The rest is closer to bug fixes. Commits ------- af9c035 Tweak error/exception handler registration
We need a way to register DebugClassLoader, and maybe a few other things. Basically what we do in SymfonyTestsListenerTrait. |
ab2f604
to
e56f932
Compare
e56f932
to
bddc3f5
Compare
d72eadc
to
c89477a
Compare
…fore (xabbuh) This PR was merged into the 7.2 branch. Discussion ---------- [HttpClient] return early if handle has been cleaned up before | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT When a request has been cleaned up by the PHP process there still can be an event that will later on try to generate the response. Previously this lead to a warning like `Undefined array key "bg"`. spotted in #58370 where this makes the test fail with PHPUnit 11.5: https://github.com/symfony/symfony/actions/runs/16051022174/job/45293445147#step:9:3827 Commits ------- fb4711b return early if handle has been cleaned up before
022669a
to
502d029
Compare
89953f7
to
5922e42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive work!
@@ -222,7 +222,7 @@ jobs: | |||
echo "::group::install phpunit" | |||
./phpunit install | |||
echo "::endgroup::" | |||
echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 | |||
echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT --exclude-group tty,benchmark,intl-data,integration,transient,legacy'" || X=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no repeated --exclude-group
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this job uses the PhpUnitBridge from the 6.4
branch which will use PHPUnit 9.6 where we need to pass groups like this: https://github.com/symfony/symfony/actions/runs/16643576218/job/47099900084?pr=58370#step:9:14680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which also means that we need to update this line for the 8.x lifecycle after merging up
"symfony/http-kernel": "^6.4|^7.0|^8.0", | ||
"symfony/framework-bundle": "^6.4.13|^7.1.6|^8.0", | ||
"symfony/http-kernel": "^6.4.13|^7.1.6|^8.0", | ||
"symfony/runtime": "^6.4.13|^7.1.6|^8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why adding runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need #58372, otherwise tests fail like this with low deps:
PHPUnit 11.5.28 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.29
Configuration: /home/runner/work/symfony/symfony/src/Symfony/Bridge/PsrHttpMessage/phpunit.xml.dist
...........................RRR........ 38 / 38 (100%)
Time: 00:00.163, Memory: 28.00 MB
There were 3 risky tests:
1) Symfony\Bridge\PsrHttpMessage\Tests\Functional\ControllerTest::testServerRequestAction
Test code or tested code did not remove its own exception handlers
/home/runner/work/symfony/symfony/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/ControllerTest.php:22
2) Symfony\Bridge\PsrHttpMessage\Tests\Functional\ControllerTest::testRequestAction
Test code or tested code did not remove its own exception handlers
/home/runner/work/symfony/symfony/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/ControllerTest.php:31
3) Symfony\Bridge\PsrHttpMessage\Tests\Functional\ControllerTest::testMessageAction
Test code or tested code did not remove its own exception handlers
/home/runner/work/symfony/symfony/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/ControllerTest.php:40
OK, but there were issues!
Tests: 38, Assertions: 260, PHPUnit Deprecations: 4, Risky: 3.
Job exited with: 1
5922e42
to
6f6b5fe
Compare
6f6b5fe
to
652ba2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Thank you @xabbuh. |
Many thanks 🙌❤️ |
No way! Thanks @xabbuh for getting this one over the finish line! |
You did it!! This was a massive effort. Thanks a lot @xabbuh! 💚 |
…ionMessage() method (xabbuh) This PR was merged into the 7.4 branch. Discussion ---------- [HttpFoundation] use PHPUnit's native expectUserDeprecationMessage() method | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT In #58370 I rewrote the tests in `NativeSessionStorageTest` to work around a bug in PHPUnit that didn't allow to have assertions about deprecations triggered in tests that were run in separate processes. Thanks to sebastianbergmann/phpunit#6283 (available in e.g. PHPUnit 12.3.5+) we don't need this workaround anymore. Commits ------- c7b14f8 use PHPUnit's native expectUserDeprecationMessage() method
Uh oh!
There was an error while loading. Please reload this page.