You are here

protected function TranslationStringTest::rebootAndPrepareSettings in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 62
Contains \Drupal\KernelTests\Core\StringTranslation\TranslationStringTest.

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);
}