[wp-trac] [WordPress Trac] #57236: Add $wp_filters to WP_UnitTestCase_Base::_backup_hooks() and ::_restore_hooks()
WordPress Trac
noreply at wordpress.org
Sun Jan 29 16:24:17 UTC 2023
#57236: Add $wp_filters to WP_UnitTestCase_Base::_backup_hooks() and
::_restore_hooks()
-------------------------------------------------+-------------------------
Reporter: SergeyBiryukov | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.2
Component: Build/Test Tools | Version:
Severity: normal | Resolution: fixed
Keywords: good-first-bug has-patch has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"55160" 55160]:
{{{
#!CommitTicketReference repository="" revision="55160"
Build/Test Tools: Back up and restore the `$wp_filters` global when
running tests.
Introduced along with the `did_filter()` function, the `$wp_filters`
global stores the number of times each filter has been applied during the
current request.
This commit adds `$wp_filters` to the list of globals that are saved in
`WP_UnitTestCase_Base::_backup_hooks()` and restored in
`::_restore_hooks()` so that hooks set by the current test do not
accidentally affect future tests.
Additionally, this commit brings some consistency by backing up and
restoring the hook-related globals in the same order they are defined in
`wp-includes/plugin.php`.
Follow-up to [29251], [53803].
Props sanjucta, SergeyBiryukov.
Fixes #57236.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57236#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list