You are here

protected function MemoryBackendTest::createCacheBackend in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php \Drupal\KernelTests\Core\Cache\MemoryBackendTest::createCacheBackend()
  2. 9 core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php \Drupal\KernelTests\Core\Cache\MemoryBackendTest::createCacheBackend()

Creates a new instance of MemoryBackend.

Return value

A new MemoryBackend object.

Overrides GenericCacheBackendUnitTestBase::createCacheBackend

File

core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php, line 20

Class

MemoryBackendTest
Unit test of the memory cache backend using the generic cache unit test base.

Namespace

Drupal\KernelTests\Core\Cache

Code

protected function createCacheBackend($bin) {
  $backend = new MemoryBackend();
  \Drupal::service('cache_tags.invalidator')
    ->addInvalidator($backend);
  return $backend;
}