You are here

public function CacheCollectorTest::testCacheCollector in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php \Drupal\KernelTests\Core\Cache\CacheCollectorTest::testCacheCollector()
  2. 9 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 39

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));
}