summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authormarkpavlitski2014-02-14 22:33:25 (GMT)
committerJeremy Andrews2014-02-14 22:33:25 (GMT)
commit5c52cfff2305d3dceee4662341d8353fac71a303 (patch)
treec05b0ed6195fe2d04e849a506ac442eca6e15af6 /tests
parent1279c663b25da4abe0f7fa3acc2f2dd10196bbed (diff)
Issue #1634506 by markpavlitski: properly flush temporary items.7.x-1.1-beta2
Diffstat (limited to 'tests')
-rw-r--r--tests/memcache.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/memcache.test b/tests/memcache.test
index 73c01d3..d1b3c20 100644
--- a/tests/memcache.test
+++ b/tests/memcache.test
@@ -393,6 +393,30 @@ class MemCacheClearCase extends MemcacheTestCase {
$this->assertCacheRemoved(t('Foofoo cache invalidated.'), 'foofoo');
}
+ /**
+ * Test CACHE_TEMPORARY and CACHE_PERMANENT behaviour.
+ */
+ function testClearTemporaryPermanent() {
+ cache_set('test_cid_clear_temporary', $this->default_value, $this->default_bin, CACHE_TEMPORARY);
+ cache_set('test_cid_clear_permanent', $this->default_value, $this->default_bin, CACHE_PERMANENT);
+ cache_set('test_cid_clear_future', $this->default_value, $this->default_bin, time() + 3600);
+
+ $this->assertTrue($this->checkCacheExists('test_cid_clear_temporary', $this->default_value)
+ && $this->checkCacheExists('test_cid_clear_permanent', $this->default_value)
+ && $this->checkCacheExists('test_cid_clear_future', $this->default_value),
+ t('Three cache items were created for checking cache expiry.'));
+
+ // This should clear only expirable items (CACHE_TEMPORARY).
+ cache_clear_all(NULL, $this->default_bin, TRUE);
+
+ $this->assertFalse($this->checkCacheExists('test_cid_clear_temporary', $this->default_value),
+ t('Temporary cache item was removed after clearing cid NULL.'));
+ $this->assertTrue($this->checkCacheExists('test_cid_clear_permanent', $this->default_value),
+ t('Permanent cache item was not removed after clearing cid NULL.'));
+ $this->assertTrue($this->checkCacheExists('test_cid_clear_future', $this->default_value),
+ t('Future cache item was not removed after clearing cid NULL.'));
+ }
+
/**
* Test clearing using a cid.