mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Build/Test Tools: Call wp_cache_flush_runtime in WP_UnitTestCase.
In `WP_UnitTestCase::flush_cache` method, the properties of the global `$wp_object_cache` object were manaully being reset to flush the cache. The function `wp_cache_flush_runtime` was added in [52772] and is designed to reset any class properties to default values. Using `wp_cache_flush_runtime` improve compatibility with third party object caches, as it allows developers to define their own `wp_cache_flush_runtime` function. Props rmccue, johnbillion, wonderboymusic, boonebgorges, voldemortensen, dd32, DrewAPicture, tillkruess, spacedmonkey. Fixes #31463. git-svn-id: https://develop.svn.wordpress.org/trunk@55741 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -387,12 +387,9 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
|
||||
public static function flush_cache() {
|
||||
global $wp_object_cache;
|
||||
|
||||
$wp_object_cache->group_ops = array();
|
||||
$wp_object_cache->stats = array();
|
||||
$wp_object_cache->memcache_debug = array();
|
||||
$wp_object_cache->cache = array();
|
||||
wp_cache_flush_runtime();
|
||||
|
||||
if ( method_exists( $wp_object_cache, '__remoteset' ) ) {
|
||||
if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, '__remoteset' ) ) {
|
||||
$wp_object_cache->__remoteset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user