You are here

public function ContentNegotiationRoutingTest::register in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php \Drupal\KernelTests\Core\Routing\ContentNegotiationRoutingTest::register()

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

core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php, line 37

Class

ContentNegotiationRoutingTest
Tests content negotiation routing variations.

Namespace

Drupal\KernelTests\Core\Routing

Code

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

  // \Drupal\KernelTests\KernelTestBase::register() removes the alias path
  // processor.
  if ($container
    ->hasDefinition('path_alias.path_processor')) {
    $definition = $container
      ->getDefinition('path_alias.path_processor');
    $definition
      ->addTag('path_processor_inbound', [
      'priority' => 100,
    ])
      ->addTag('path_processor_outbound', [
      'priority' => 300,
    ]);
  }
}