You are here

BackendChainTest.php in Drupal 9

Same filename and directory in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php

File

core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php
View source
<?php

namespace Drupal\KernelTests\Core\Cache;

use Drupal\Core\Cache\BackendChain;
use Drupal\Core\Cache\MemoryBackend;

/**
 * Unit test of the backend chain using the generic cache unit test base.
 *
 * @group Cache
 */
class BackendChainTest extends GenericCacheBackendUnitTestBase {
  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;
  }

}

Classes

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