From f8987239df94cc120306fc967f2c18bb6ee2038c Mon Sep 17 00:00:00 2001 From: Josh Betz Date: Fri, 10 Apr 2020 12:36:41 -0500 Subject: [PATCH] Add test for the wp_cache_get $found variable Tests whether the $found variable works for memcached operations. We bypass the local in-memory cache to force wp_cache_get to do a remote operation. --- tests/test-object-cache.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test-object-cache.php b/tests/test-object-cache.php index 7b9e1a1..f8885a5 100644 --- a/tests/test-object-cache.php +++ b/tests/test-object-cache.php @@ -891,4 +891,16 @@ public function test_found_gives_an_accurate_representation_of_whether_or_not_it $this->assertFalse( $found ); } + + public function test_found_wp_cache_get() { + $found = null; + + // Force to read from cache + wp_cache_get( 'foo', null, true, $found ); + $this->assertFalse( $found ); + + wp_cache_set( 'foo', false ); + wp_cache_get( 'foo', null, true, $found ); + $this->assertTrue( $found ); + } }