protected function BackendChainTest::createCacheBackend in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php \Drupal\KernelTests\Core\Cache\BackendChainTest::createCacheBackend()
- 9 core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php \Drupal\KernelTests\Core\Cache\BackendChainTest::createCacheBackend()
Creates a cache backend to test.
Override this method to test a CacheBackend.
Parameters
string $bin: Bin name to use for this backend instance.
Return value
\Drupal\Core\Cache\CacheBackendInterface Cache backend to test.
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\CacheCode
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;
}