function BackendChainTest::createCacheBackend

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php \Drupal\KernelTests\Core\Cache\BackendChainTest::createCacheBackend()
  2. 10 core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php \Drupal\KernelTests\Core\Cache\BackendChainTest::createCacheBackend()
  3. 11.x core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php \Drupal\KernelTests\Core\Cache\BackendChainTest::createCacheBackend()

Overrides GenericCacheBackendUnitTestBase::createCacheBackend

File

core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php, line 15

Class

BackendChainTest
Unit test of the backend chain using the generic cache unit test base.

Namespace

Drupal\KernelTests\Core\Cache

Code

protected function createCacheBackend($bin) {
    $chain = new BackendChain();
    // We need to create some various backends in the chain.
    $chain->appendBackend(new MemoryBackend())
        ->prependBackend(new MemoryBackend())
        ->appendBackend(new MemoryBackend());
    \Drupal::service('cache_tags.invalidator')->addInvalidator($chain);
    return $chain;
}

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