diff options
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/cache.test | 24 |
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() { |