You are here

function ApcCacheClearCase::testClearWildcard in APC - Alternative PHP Cache 7

Test clearing using wildcard.

File

tests/apc.test, line 271

Class

ApcCacheClearCase
Test cache clearing methods.

Code

function testClearWildcard() {
  cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
  cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
  $this
    ->assertTrue($this
    ->checkCacheExists('test_cid_clear1', $this->default_value) && $this
    ->checkCacheExists('test_cid_clear2', $this->default_value), t('Two caches were created for checking cid "*" with wildcard true.'));
  cache_clear_all('*', $this->default_bin, TRUE);
  $this
    ->assertFalse($this
    ->checkCacheExists('test_cid_clear1', $this->default_value) || $this
    ->checkCacheExists('test_cid_clear2', $this->default_value), t('Two caches removed after clearing cid "*" with wildcard true.'));
  cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
  cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
  $this
    ->assertTrue($this
    ->checkCacheExists('test_cid_clear1', $this->default_value) && $this
    ->checkCacheExists('test_cid_clear2', $this->default_value), t('Two caches were created for checking cid substring with wildcard true.'));
  cache_clear_all('test_', $this->default_bin, TRUE);
  $this
    ->assertFalse($this
    ->checkCacheExists('test_cid_clear1', $this->default_value) || $this
    ->checkCacheExists('test_cid_clear2', $this->default_value), t('Two caches removed after clearing cid substring with wildcard true.'));
}