public function ApdqcCacheIsEmptyCase::testIsEmpty in Asynchronous Prefetch Database Query Cache 7
Test clearing using a cid.
File
- ./
apdqc.test, line 312 - Tests for the Asynchronous Prefetch Database Query Cache module.
Class
- ApdqcCacheIsEmptyCase
- Test isEmpty() function.
Code
public function testIsEmpty() {
$cache = new APDQCache($this->defaultBin);
// Clear the cache bin.
$cache
->clear('*', TRUE);
// Run the test.
$this
->assertTrue($cache
->isEmpty(), 'The cache bin is empty');
// Add some data to the cache bin.
$cache
->set($this->defaultCid, $this->defaultValue, CACHE_PERMANENT);
$this
->assertCacheExists(t('Cache was set.'), $this->defaultValue, $this->defaultCid);
// Run the test.
$this
->assertFalse($cache
->isEmpty(), 'The cache bin is not empty');
// Remove the cached data.
$cache
->clear($this->defaultCid, FALSE);
// Run the test.
$this
->assertCacheRemoved(t('Cache was removed.'), $this->defaultCid);
$this
->assertTrue($cache
->isEmpty(), 'The cache bin is empty');
}