You are here

protected function TranslationStringTest::rebootAndPrepareSettings in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php \Drupal\KernelTests\Core\StringTranslation\TranslationStringTest::rebootAndPrepareSettings()
  2. 9 core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php \Drupal\KernelTests\Core\StringTranslation\TranslationStringTest::rebootAndPrepareSettings()

Reboots the kernel to set custom translations in Settings.

1 call to TranslationStringTest::rebootAndPrepareSettings()
TranslationStringTest::testComparison in core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php
Tests that TranslatableMarkup objects can be compared.

File

core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php, line 57

Class

TranslationStringTest
Tests the TranslatableMarkup class.

Namespace

Drupal\KernelTests\Core\StringTranslation

Code

protected function rebootAndPrepareSettings() {

  // Reboot the container so that different services are injected and the new
  // settings are picked.
  $kernel = $this->container
    ->get('kernel');
  $kernel
    ->shutdown();
  $kernel
    ->boot();
  $settings = Settings::getAll();
  $settings['locale_custom_strings_de'] = [
    '' => [
      'Example @number' => 'Example @number translated',
    ],
  ];

  // Recreate the settings static.
  new Settings($settings);
}