You are here

public function LanguageTest::register in Token 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/LanguageTest.php, line 71

Class

LanguageTest
Tests language tokens.

Namespace

Drupal\Tests\token\Kernel

Code

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

  // Use Portuguese as the default language during the test. We're not using
  // English so we can detect if the default language is correctly honored.
  $language = Language::$defaultValues;
  $language['id'] = 'pt-pt';
  $language['name'] = 'Portuguese, Portugal';
  $container
    ->setParameter('language.default_values', $language);
  $this->container
    ->register('language.default', 'Drupal\\Core\\Language\\LanguageDefault')
    ->addArgument('%language.default_values%');
}