[PhpUnitBridge] Add ExpectUserDeprecationMessageTrait#54593
Merged
Conversation
5c769cc to
24ff1b6
Compare
stof
reviewed
Apr 17, 2024
24ff1b6 to
66430f3
Compare
c5093c3 to
4fd7256
Compare
4fd7256 to
2485e15
Compare
ExpectUserDeprecationMessageTrait
GromNaN
approved these changes
Jul 22, 2024
GromNaN
left a comment
Member
There was a problem hiding this comment.
This change is surprisingly simple. Well done.
xabbuh
reviewed
Jul 22, 2024
xabbuh
approved these changes
Jul 22, 2024
javiereguiluz
approved these changes
Jul 24, 2024
javiereguiluz
left a comment
Member
There was a problem hiding this comment.
Good work! Thanks Alexander.
fabpot
approved these changes
Jul 25, 2024
Member
|
Thank you @derrabus. |
stof
reviewed
Sep 2, 2024
|
|
||
| final protected function expectUserDeprecationMessage(string $expectedUserDeprecationMessage): void | ||
| { | ||
| $this->expectDeprecation($expectedUserDeprecationMessage); |
Member
There was a problem hiding this comment.
Be careful. The PHPUnit 11 API performs an exact match of the deprecation message. expectDeprecation uses assertStringMatchesFormat. So this is not a good polyfill (tests that rely on format placeholders would break when using PHPUnit 11 which performs exact match)
Member
Author
There was a problem hiding this comment.
Is there a way to escape those placeholders?
Member
There was a problem hiding this comment.
you can escape by doubling % (like in sprintf patterns)
Member
Author
There was a problem hiding this comment.
So, I replace all % with %% and I should be good?
fabpot
added a commit
to twigphp/Twig
that referenced
this pull request
Sep 2, 2024
This PR was merged into the 4.x branch. Discussion ---------- Switch to expectUserDeprecationMessage() This PR leverages symfony/symfony#54593. This will make it easier to switch to a vanilla PHPUnit 11 in the future. Commits ------- 0ab26b0 Switch to expectUserDeprecationMessage()
derrabus
added a commit
that referenced
this pull request
Sep 19, 2024
This PR was merged into the 7.2 branch. Discussion ---------- Switch to ExpectUserDeprecationMessageTrait | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT This PR switches some tests added after #54593 to our new trait, allowing us to run those under PHPUnit 11 as well. Commits ------- d923c28 Switch to ExpectUserDeprecationMessageTrait
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHPUnit 11 introduces a method
expectUserDeprecationMessage()which lets us define which deprecation messages we expect the tested code to raise. This new method can replace our ownexpectDeprecation()method once we upgrade to PHPUnit 11.This PR introduces a
ExpectUserDeprecationMessageTraitthat polyfills this method for older PHPUnit versions. This allowed me to run all tests that I've migrated toexpectUserDeprecationMessage()with PHPUnit 11.