-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Implement expectUserDeprecationMessage()
and expectUserDeprecationMessageMatches()
to expect E_USER_DEPRECATED
issues
#5605
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5605 +/- ##
============================================
+ Coverage 88.48% 88.51% +0.03%
- Complexity 6272 6293 +21
============================================
Files 668 673 +5
Lines 20068 20125 +57
============================================
+ Hits 17757 17814 +57
Misses 2311 2311 ☔ View full report in Codecov by Sentry. |
9233648
to
ec415a7
Compare
The feature of the symfony/phpunit-bridge actually allows defining multiple expected deprecations in the same test. This does not seem to be supported by your feature. |
Btw, is it actually true that PHP issues have non-empty-string as their message ? Isn't it possible in PHP to pass an empty string to |
Would this help? $this->expectUserDeprecationMessage(
[
'deprecation message',
'another deprecation message',
]
); |
That may be the case, but is outside the scope of this PR. |
Well, I asked that question because this PR is adding those |
This could work. But wouldn't it be possible to call the method multiple times instead ? This would more closely match our existing API (and maybe allow us to provide a compatibility layer for the migration) |
No, it is not. Those changes were done in |
I already started implementing this instead of what I proposed :) |
ec415a7
to
029aa2b
Compare
Pushed. |
Force-pushed the latest changes and now this PR only shows changes exclusive to the respective branch. |
@sebastianbergmann Thanks for asking.
Correct. I did so as I'm seeing that a number of code bases are not making the move to support PHPUnit 10 largely because they can no longer test their own deprecations (and to a much lesser extend notices and warnings).
I don't see this as directly related to each other ? The |
…ccept 'another message'
@stof Thank you for reviewing this! |
This implements the
expectUserDeprecationMessage()
andexpectUserDeprecationMessageMatches()
methods for expectingE_USER_DEPRECATED
issues.The test method must be attributed with
#[PHPUnit\Framework\Attributes\IgnoreDeprecations]
in order to not have the expected deprecation(s) trigger PHPUnit's default handling ofE_USER_DEPRECATED
issues.Multiple deprecations can be expected in the same test by calling
expectUserDeprecationMessage()
andexpectUserDeprecationMessageMatches()
multiple times.@stof This is my first attempt to implement what we discussed yesterday. Would this help you?