function CacheCollectorTest::register

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

Overrides KernelTestBase::register

File

core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php, line 23

Class

CacheCollectorTest
Tests DatabaseBackend cache tag implementation.

Namespace

Drupal\KernelTests\Core\Cache

Code

public function register(ContainerBuilder $container) {
    parent::register($container);
    // Change container to database cache backends.
    $container->register('cache_factory', 'Drupal\\Core\\Cache\\CacheFactory')
        ->addArgument(new Reference('settings'))
        ->addMethodCall('setContainer', [
        new Reference('service_container'),
    ]);
    // Change container to use database lock backends.
    $container->register('lock', 'Drupal\\Core\\Lock\\DatabaseLockBackend')
        ->addArgument(new Reference('database'));
}

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