[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
Sun Sep 26 03:27:24 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: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
------------------------------+------------------------------
Comment (by SergeyBiryukov):
In [changeset:"51872" 51872]:
{{{
#!CommitTicketReference repository="" revision="51872"
Tests: Update the `Services_JSON` test for PHPUnit 9.5.10/8.5.21+.
Since PHPUnit 9.5.10 and 8.5.21, PHP deprecations are no longer converted
to exceptions by default (`convertDeprecationsToExceptions="true"` can be
configured to enable this).
Reference:
[https://github.com/sebastianbergmann/phpunit/commit/fac02620f6b38ae54d47fe840e0095e68226a56c
Do not convert PHP deprecations to exceptions by default];
[https://github.com/sebastianbergmann/phpunit/blob/9.5.10/ChangeLog-9.5.md#9510
---2021-09-25 PHPUnit 9.5.10 changelog].
With this change, the test for the `Services_JSON` compat class started
failing:
{{{
There was 1 failure:
1) Tests_Compat_jsonEncodeDecode::test_json_encode_decode
Failed asserting that exception of type
"PHPUnit\Framework\Error\Deprecated" is thrown.
}}}
This converts the native PHPUnit `::expectDeprecation()` method call in
the test to a set of individual WP-specific `::setExpectedDeprecated()`
method calls in order to not depend on PHPUnit behavior that is no longer
the default.
Additionally, this commit includes support for catching deprecation
notices from `_deprecated_file()` function calls to the
`WP_UnitTestCase_Base::expectDeprecated()` method.
Follow-up to [46205], [46625], [48996], [51563], [51852], [51871].
Props jrf, netweb, SergeyBiryukov.
See #54183, #54029, #53363.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54029#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list