From cae64c5e130437d1db6874d0ef257fe99fac6222 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 2 Oct 2015 05:05:26 +0000 Subject: [PATCH] Unit Tests: in `Tests_Cache::test_wp_cache_init()`, when `wp_using_ext_object_cache()`, just check that the global is an instance of `WP_Object_Cache`. External object cache instances of `WP_Object_Cache` will contain resources as props that will always have differing internal IDs, so strict comparison won't work. See #31491. git-svn-id: https://develop.svn.wordpress.org/trunk@34765 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/cache.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php index fd93a0940b..d3805383a7 100644 --- a/tests/phpunit/tests/cache.php +++ b/tests/phpunit/tests/cache.php @@ -281,7 +281,13 @@ class Tests_Cache extends WP_UnitTestCase { wp_cache_init(); global $wp_object_cache; - $this->assertEquals( $wp_object_cache, $new_blank_cache_object ); + + if ( wp_using_ext_object_cache() ) { + // External caches will contain property values that contain non-matching resource IDs + $this->assertInstanceOf( 'WP_Object_Cache', $wp_object_cache ); + } else { + $this->assertEquals( $wp_object_cache, $new_blank_cache_object ); + } } function test_wp_cache_replace() {