You are here

public function CacheCollectorTest::testCacheCollector in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php \Drupal\KernelTests\Core\Cache\CacheCollectorTest::testCacheCollector()

Tests setting and invalidating

@dataProvider providerTestInvalidCharacters

File

core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php, line 55
\Drupal\KernelTests\Core\Cache\CacheCollectorTest.

Class

CacheCollectorTest
Tests DatabaseBackend cache tag implementation.

Namespace

Drupal\KernelTests\Core\Cache

Code

public function testCacheCollector($cid, $key, $value) {
  $collector = new CacheCollectorHelper($cid, $this->container
    ->get('cache.default'), $this->container
    ->get('lock'));
  $this
    ->assertNull($collector
    ->get($key));
  $collector
    ->set($key, $value);
  $this
    ->assertEquals($value, $collector
    ->get($key));
  $collector
    ->destruct();

  // @todo Shouldn't this be empty after destruction?
  $this
    ->assertEquals($value, $collector
    ->get($key));
}