public function FeedsHTTPCacheTest::testClearAll in Feeds 7.2
@covers FeedsHTTPCache::clear().
Tests if all cached files can get cleaned up.
File
- tests/
FeedsHTTPCacheTest.test, line 440
Class
- FeedsHTTPCacheTest
- @coversDefaultClass FeedsHTTPCache @group feeds
Code
public function testClearAll() {
// Create a few cache entries.
$cid1 = $this
->createCacheRecordUsingApi();
$cid2 = $this
->createCacheRecordUsingApi();
$cid3 = $this
->createCacheRecordUsingApi();
// Now clear complete cache.
$this->cache
->clear('*', TRUE);
// Assert that cache_feeds_http is empty.
$count = db_select('cache_feeds_http')
->fields('cache_feeds_http', array(
'cid',
))
->countQuery()
->execute()
->fetchField();
$this
->assertEqual(0, $count, 'The cache_feeds_http item is empty.');
// Assert that the feeds cache dir is empty.
$empty = count(glob(static::FEEDS_CACHE_DIR . '/*')) === 0;
$this
->assertTrue($empty, 'The feeds cache directory is empty.');
}