Skip to content

Commit 94ebea0

Browse files
author
Ian Jenkins
committed
Add test for Issue #61
1 parent 9793b46 commit 94ebea0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test-object-cache.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ public function test_add_non_persistent_groups_does_not_allow_duplicate_groups()
145145
$this->assertCount( 1, array_keys( $this->object_cache->no_mc_groups, 'group-1' ) );
146146
}
147147

148+
public function test_found_is_set_when_using_non_persistent_groups(): void {
149+
/**
150+
* wp> wp_cache_add_non_persistent_groups( [ 'example' ] );
151+
* NULL
152+
* wp> wp_cache_set( 'example', 'example', 'example' );
153+
* bool(true)
154+
* wp> wp_cache_get( 'example', 'example', false, $found );
155+
* string(7) "example"
156+
* wp> $found
157+
* bool(false)
158+
*/
159+
160+
$groups = [ 'example' ];
161+
$this->object_cache->add_non_persistent_groups( $groups );
162+
$this->object_cache->set( 'example', 'example', 'example' );
163+
$this->object_cache->get( 'example', 'example', false, $found );
164+
165+
$this->assertTrue( $found );
166+
}
167+
148168
// Tests for increment.
149169

150170
public function test_incr_increments_a_numeric_value(): void {

0 commit comments

Comments
 (0)