function CacheCollectorTest::testCacheCollector

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php \Drupal\KernelTests\Core\Cache\CacheCollectorTest::testCacheCollector()
  2. 10 core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php \Drupal\KernelTests\Core\Cache\CacheCollectorTest::testCacheCollector()
  3. 11.x 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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.