You are here

public function RedisCacheTest::register in Redis 8

Registers test-specific services.

Extend this method in your test to register additional services. This method is called whenever the kernel is rebuilt.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The service container to enhance.

Overrides KernelTestBase::register

See also

\Drupal\Tests\KernelTestBase::bootKernel()

File

tests/src/Kernel/RedisCacheTest.php, line 26

Class

RedisCacheTest
Tests Redis cache backend using GenericCacheBackendUnitTestBase.

Namespace

Drupal\Tests\redis\Kernel

Code

public function register(ContainerBuilder $container) {
  self::setUpSettings();
  parent::register($container);

  // Replace the default checksum service with the redis implementation.
  if ($container
    ->has('redis.factory')) {
    $container
      ->register('cache_tags.invalidator.checksum', 'Drupal\\redis\\Cache\\RedisCacheTagsChecksum')
      ->addArgument(new Reference('redis.factory'))
      ->addTag('cache_tags_invalidator');
  }
}