public function FeedsHTTPCacheTest::testIsEmpty in Feeds 7.2
@covers FeedsHTTPCache::isEmpty().
File
- tests/
FeedsHTTPCacheTest.test, line 494
Class
- FeedsHTTPCacheTest
- @coversDefaultClass FeedsHTTPCache @group feeds
Code
public function testIsEmpty() {
// Add a record to the cache_feeds_http table.
$this
->createCacheRecord();
// Assert that the cache is not empty.
$this
->assertFalse($this->cache
->isEmpty(), 'The cache is empty.');
// Truncate the table and assert that the cache class tells us that it is
// empty.
db_truncate('cache_feeds_http')
->execute();
$this
->assertTrue($this->cache
->isEmpty());
// Add a file to the cache dir, without a entry in the database.
$dir = static::FEEDS_CACHE_DIR;
file_prepare_directory($dir, FILE_CREATE_DIRECTORY);
file_put_contents(static::FEEDS_CACHE_DIR . '/abc123', static::randomName());
// And assert that the cache class reports that the cache is not empty.
$this
->assertFalse($this->cache
->isEmpty());
}