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.
Built from https://develop.svn.wordpress.org/trunk@55160


git-svn-id: http://core.svn.wordpress.org/trunk@54693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-01-29 16:26:15 +00:00
parent 9c04271f60
commit 319fadaa9c

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55159';
$wp_version = '6.2-alpha-55160';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.