-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
base: 7.3
Are you sure you want to change the base?
run tests using PHPUnit 11.5 #58370
Conversation
xabbuh
commented
Sep 24, 2024
•
edited by derrabus
Loading
edited by derrabus
Q | A |
---|---|
Branch? | 7.3 |
Bug fix? | no |
New feature? | no |
Deprecations? | no |
Issues | |
License | MIT |
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
56d703c
to
eb73303
Compare
@symfony/mergers The PR is finally ready to be reviewed. Status: Needs Review |
.github/workflows/windows.yml
Outdated
|
||
env: | ||
COMPOSER_NO_INTERACTION: '1' | ||
SYMFONY_DEPRECATIONS_HELPER: 'strict' |
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 env var should not be necessary anymore, as it won't be used with PHPUnit 11
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.
removed it
.github/workflows/unit-tests.yml
Outdated
@@ -76,7 +76,7 @@ jobs: | |||
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" | |||
|
|||
echo COLUMNS=120 >> $GITHUB_ENV | |||
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration" >> $GITHUB_ENV | |||
echo PHPUNIT="$(pwd)/phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group integration --fail-on-deprecation" >> $GITHUB_ENV |
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.
I suggest configuring --fail-on-deprecation
through the config file instead, so that it is also failing when running locally.
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.
done
.github/workflows/unit-tests.yml
Outdated
@@ -140,7 +140,7 @@ jobs: | |||
[[ "${{ matrix.mode }}" = *-deps ]] && mv composer.json.phpunit composer.json || true | |||
|
|||
if [[ "${{ matrix.mode }}" = low-deps ]]; then | |||
echo SYMFONY_PHPUNIT_REQUIRE="nikic/php-parser:^4.18" >> $GITHUB_ENV | |||
echo SYMFONY_PHPUNIT_REQUIRE="nikic/php-parser:^5.0" >> $GITHUB_ENV |
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.
Do we still have a job testing our compat with nikic/php-parser
v4 for our code using it ?
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.
I am afraid we cannot: #58370 (comment):
PHPUnit 11 (through its dependency on
phpunit/php-code-coverage
is not compatible withnikic/php-parser
4
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.
Only Translation supports v4, I would bump it to ^5 on 7.3
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.
see #60255
@@ -251,9 +250,7 @@ public static function idsProvider(): iterable | |||
yield ['foo']; | |||
} | |||
|
|||
/** | |||
* @group legacy |
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.
should we keep a legacy
group for our tests covering deprecated behaviors ? Our deps=high
job is excluding this group when running tests for a version that is not part of the last major version (as the dependencies could be installed at the next major version already):
symfony/.github/workflows/unit-tests.yml
Lines 134 to 135 in fe94cfb
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one | |
[[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=,legacy >> $GITHUB_ENV || true |
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.
thinking about this again, I think this option was overkill and was leading to not testing some parts of the code in CI in our LTS branches. Many legacy tests we have are about testing deprecations of their own component, which does not need such exclusion. Tests relying on cross-package deprecations could be responsible for skipping themselves when needed.
/** | ||
* @group legacy | ||
*/ | ||
#[IgnoreDeprecations] |
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.
Unrelated to this PR, but we should update those tests. I'm quite sure most of them are not legacy ones that are supposed to be removed in 8.0 (but they have not been updated to use named arguments for the constraint constructor)
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.
I'm quite sure that they can indeed be removed. Before #54744 we had data providers configuring the constraints with both ways (named arguments and associative options array) to configure them, but I split those tests into two when deprecating the non named arguments way.
@@ -18,7 +17,7 @@ | |||
</testsuite> | |||
</testsuites> | |||
|
|||
<coverage> | |||
<source> |
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 the ignoreSuppressionOfDeprecations="true"
parameter in the component-level config files as well.
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.
done
@@ -17,6 +17,9 @@ | |||
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup; | |||
use Symfony\Component\ErrorHandler\DebugClassLoader; | |||
|
|||
/** | |||
* @requires PHPUnit < 10 |
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.
shouldn't this have the attribute as well, so that PHPUnit 11 excludes it ?
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.
in fact, I even think that having the attribute without the annotation should be sufficient
@@ -67,9 +68,8 @@ public function testInvalidValues($value, $message, $line) | |||
|
|||
/** | |||
* When deprecations are skipped by the validator, the testsuite reporter will catch them so we need to mark the test as legacy. |
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.
* When deprecations are skipped by the validator, the testsuite reporter will catch them so we need to mark the test as legacy. | |
* When deprecations are skipped by the validator, the testsuite reporter will catch them so we need to mark the test as ignoring deprecations. |
# HttpClient tests need to run separately, they block when run with other components' tests concurrently | ||
php phpunit src\Symfony\Component\HttpClient || ($x = 1) | ||
|
||
exit $x | ||
|
||
windows-all-extensions: |
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.
To make things easier to maintain, would it be worth backporting this split of the Windows jobs ? what do you think @nicolas-grekas ?
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 talked about that in #58721 but decided to not split the two test runs as we would otherwise run many of the tests twice since the phpunit.skipped
would not be shared
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.
I don't see any discussion about that in the PR you linked
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.
hm, maybe @nicolas-grekas and me talked about that on Slack directly 🤔
Tests are not actually running with PHPUnit 11.5: https://github.com/symfony/symfony/actions/runs/14563576793/job/40849847611?pr=58370#step:6:44 |
70f5b92
to
3e19ea6
Compare
Isn't that related to how our CI is configured? I mean the previous commit that is checked out does not have the changes needed in |
39cc605
to
ca642e4
Compare
@@ -30,7 +30,7 @@ | |||
"symfony/dependency-injection": "^6.4|^7.0", | |||
"symfony/doctrine-messenger": "^6.4|^7.0", | |||
"symfony/expression-language": "^6.4|^7.0", | |||
"symfony/form": "^6.4.6|^7.0.6", | |||
"symfony/form": "^7.2", |
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.
because we need #58357
03885db
to
890b854
Compare
890b854
to
8f0b304
Compare