ChainedFastBackendTest.php

Same filename in this branch
  1. 10 core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
Same filename in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
  2. 9 core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
  3. 8.9.x core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
  4. 8.9.x core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
  5. 11.x core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
  6. 11.x core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php

Namespace

Drupal\KernelTests\Core\Cache

File

core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Core\Cache;

use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\ChainedFastBackend;
use Drupal\Core\Cache\DatabaseBackend;
use Drupal\Core\Cache\PhpBackend;

/**
 * Unit test of the fast chained backend using the generic cache unit test base.
 *
 * @group Cache
 */
class ChainedFastBackendTest extends GenericCacheBackendUnitTestBase {
    
    /**
     * Creates a new instance of ChainedFastBackend.
     *
     * @return \Drupal\Core\Cache\ChainedFastBackend
     *   A new ChainedFastBackend object.
     */
    protected function createCacheBackend($bin) {
        $consistent_backend = new DatabaseBackend(\Drupal::service('database'), \Drupal::service('cache_tags.invalidator.checksum'), $bin, \Drupal::service('serialization.phpserialize'), \Drupal::service(TimeInterface::class), 100);
        $fast_backend = new PhpBackend($bin, \Drupal::service('cache_tags.invalidator.checksum'), \Drupal::service(TimeInterface::class));
        $backend = new ChainedFastBackend($consistent_backend, $fast_backend, $bin);
        // Explicitly register the cache bin as it can not work through the
        // cache bin list in the container.
        \Drupal::service('cache_tags.invalidator')->addInvalidator($backend);
        return $backend;
    }

}

Classes

Title Deprecated Summary
ChainedFastBackendTest Unit test of the fast chained backend using the generic cache unit test base.

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