public function BackendClearTests::testClearArray in Supercache 8
Same name and namespace in other branches
- 2.0.x src/Tests/Generic/Cache/BackendClearTests.php \Drupal\supercache\Tests\Generic\Cache\BackendClearTests::testClearArray()
Test clearing using an array.
File
- src/Tests/ Generic/ Cache/ BackendClearTests.php, line 41 
Class
- BackendClearTests
- Testea funciones basicas.
Namespace
Drupal\supercache\Tests\Generic\CacheCode
public function testClearArray() {
  // Create three cache entries.
  $this->backend
    ->set('test_cid_clear1', $this->defaultvalue);
  $this->backend
    ->set('test_cid_clear2', $this->defaultvalue);
  $this->backend
    ->set('test_cid_clear3', $this->defaultvalue);
  $this
    ->assertTrue($this
    ->checkExists('test_cid_clear1', $this->defaultvalue) && $this
    ->checkExists('test_cid_clear2', $this->defaultvalue) && $this
    ->checkExists('test_cid_clear3', $this->defaultvalue), 'Three cache entries were created.');
  // Clear two entries using an array.
  $this->backend
    ->deleteMultiple(array(
    'test_cid_clear1',
    'test_cid_clear2',
  ));
  $this
    ->assertFalse($this
    ->checkExists('test_cid_clear1', $this->defaultvalue) || $this
    ->checkExists('test_cid_clear2', $this->defaultvalue), 'Two cache entries removed after clearing with an array.');
  $this
    ->assertTrue($this
    ->checkExists('test_cid_clear3', $this->defaultvalue), 'Entry was not cleared from the cache');
  $this->backend
    ->set('test_cid_clear1', $this->defaultvalue);
  $this->backend
    ->set('test_cid_clear2', $this->defaultvalue);
  $this
    ->assertTrue($this
    ->checkExists('test_cid_clear1', $this->defaultvalue) && $this
    ->checkExists('test_cid_clear2', $this->defaultvalue), 'Two cache entries were created.');
  $this->backend
    ->deleteMultiple(array(
    'test_cid_clear1',
    'test_cid_clear2',
    'test_cid_clear3',
  ));
  $this
    ->assertFalse($this
    ->checkExists('test_cid_clear1', $this->defaultvalue) || $this
    ->checkExists('test_cid_clear2', $this->defaultvalue) || $this
    ->checkExists('test_cid_clear3', $this->defaultvalue), 'All cache entries removed when the array exceeded the cache clear threshold.');
}