summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-08-05 01:36:56 -0400
committerDavid Rothstein <drothstein@gmail.com>2013-08-05 01:36:56 -0400
commitf019275be7d960060c682c69d462832fd53e02f2 (patch)
tree9e8d7628db1e35ff295d0d604e6203a4e0b81213 /modules
parent7a036f167854456ce49f167094a9965958e5bb2e (diff)
downloadbrdo-f019275be7d960060c682c69d462832fd53e02f2.tar.gz
brdo-f019275be7d960060c682c69d462832fd53e02f2.tar.bz2
Issue #238250 by markpavlitski | Xano: Fixed cache_clear_all()('*', 'block', TRUE); will TRUNCATE the {block} table without additional checks.
Diffstat (limited to 'modules')
-rw-r--r--modules/simpletest/tests/cache.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index 997f37aef..b42de360b 100644
--- a/modules/simpletest/tests/cache.test
+++ b/modules/simpletest/tests/cache.test
@@ -341,6 +341,30 @@ class CacheClearCase extends CacheTestCase {
}
/**
+ * Test DrupalDatabaseCache::isValidBin().
+ */
+ function testIsValidBin() {
+ // Retrieve existing cache bins.
+ $valid_bins = array('cache', 'cache_filter', 'cache_page', 'cache_boostrap', 'cache_path');
+ $valid_bins = array_merge(module_invoke_all('flush_caches'), $valid_bins);
+ foreach ($valid_bins as $id => $bin) {
+ $cache = _cache_get_object($bin);
+ if ($cache instanceof DrupalDatabaseCache) {
+ $this->assertTrue($cache->isValidBin(), format_string('Cache bin @bin is valid.', array('@bin' => $bin)));
+ }
+ }
+
+ // Check for non-cache tables and invalid bins.
+ $invalid_bins = array('block', 'filter', 'missing_table', $this->randomName());
+ foreach ($invalid_bins as $id => $bin) {
+ $cache = _cache_get_object($bin);
+ if ($cache instanceof DrupalDatabaseCache) {
+ $this->assertFalse($cache->isValidBin(), format_string('Cache bin @bin is not valid.', array('@bin' => $bin)));
+ }
+ }
+ }
+
+ /**
* Test minimum cache lifetime.
*/
function testMinimumCacheLifetime() {