[wp-trac] [WordPress Trac] #54029: Rename WordPress native expectDeprecated() and @ExpectedDeprecated to avoid confusion with PHPUnit native expectDeprecation and for future-proofing
WordPress Trac
noreply at wordpress.org
Fri Aug 27 19:50:02 UTC 2021
#54029: Rename WordPress native expectDeprecated() and @ExpectedDeprecated to avoid
confusion with PHPUnit native expectDeprecation and for future-proofing
----------------------------+-----------------------------
Reporter: hellofromTonya | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
WordPress' test suite has a native expectation and annotation for
expecting a deprecation notice: `expectDeprecated()` and
`@ExpectedDeprecated`.
[https://phpunit.readthedocs.io/en/8.5/writing-tests-for-phpunit.html
#testing-php-errors-warnings-and-notices PHPUnit 8 introduced a new set of
deprecation expectations]: `expectDeprecation()`,
`expectDeprecationMessage()`, and `expectDeprecationMessageMatches()`.
Notice naming conventions between WordPress and PHPUnit. They are very
similar.
||= WordPress =||= PHPUnit =||
|| `expectDeprecated()` || `expectDeprecation()` ||
|| `@ExpectedDeprecated` || - ||
== What is the problem?
The names are too similar. As such, confusion over which to use can
happen. There's a potential of using the wrong one.
Future-proof against future PHPUnit changes:
Luckily PHPUnit used "deprecation" instead of "deprecated". However,
there's the potential of future changes which may conflict with the native
WP ones.
== Proposal
Rename the expectation to include `WP` and deprecate the currently ones.
Why deprecate? To avoid a backwards-compatibility break for any extenders
using WordPress' native one.
1. Confusion and potential to use the wrong one: the names are too
similar.
2. Future-proof:
https://youtu.be/SAtiKaUwLU4?t=12019
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54029>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list