You are here

public function FeedsHTTPCacheTest::testClearMultiple in Feeds 7.2

@covers FeedsHTTPCache::clear().

Tests if multiple cached files can get cleaned up.

File

tests/FeedsHTTPCacheTest.test, line 316

Class

FeedsHTTPCacheTest
@coversDefaultClass FeedsHTTPCache @group feeds

Code

public function testClearMultiple() {

  // Create a few cache entries.
  $cid1 = $this
    ->createCacheRecordUsingApi();
  $cid2 = $this
    ->createCacheRecordUsingApi();
  $cid3 = $this
    ->createCacheRecordUsingApi();
  $cid4 = $this
    ->createCacheRecordUsingApi();

  // Remove item 2 and 4.
  $this->cache
    ->clear(array(
    $cid2,
    $cid4,
  ));

  // Assert that some records are removed.
  $this
    ->assertCacheItemExists($cid1);
  $this
    ->assertNoCacheItemExists($cid2);
  $this
    ->assertCacheItemExists($cid3);
  $this
    ->assertNoCacheItemExists($cid4);

  // Assert that only these files were removed.
  $this
    ->assertCacheFileExists($cid1);
  $this
    ->assertNoCacheFileExists($cid2);
  $this
    ->assertCacheFileExists($cid3);
  $this
    ->assertNoCacheFileExists($cid4);
}