You are here

public function PathautoEntityWithStringIdTest::register in Pathauto 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/PathautoEntityWithStringIdTest.php, line 47

Class

PathautoEntityWithStringIdTest
Tests auto-aliasing of entities that use string IDs.

Namespace

Drupal\Tests\pathauto\Kernel

Code

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

  // Kernel tests are using the 'keyvalue.memory' store but we want to test
  // against the 'keyvalue.database'.
  $container
    ->register('keyvalue.database', KeyValueDatabaseFactory::class)
    ->addArgument(new PhpSerialize())
    ->addArgument($container
    ->get('database'))
    ->addTag('persist');
  $container
    ->setAlias('keyvalue', 'keyvalue.database');
}