function LocaleConfigSubscriberTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest::setUp()
  2. 8.9.x core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest::setUp()
  3. 11.x core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php, line 55

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\Tests\locale\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this->setUpDefaultLanguage();
  $this->installSchema('locale', [
    'locales_source',
    'locales_target',
    'locales_location',
  ]);
  $this->setupLanguages();
  $this->installConfig([
    'locale_test',
  ]);
  // Simulate this hook invoked which would happen if in a non-kernel test
  // or normal environment.
  // @see locale_modules_installed()
  // @see locale_system_update()
  locale_system_set_config_langcodes();
  $langcodes = array_keys(\Drupal::languageManager()->getLanguages());
  $locale_config_manager = \Drupal::service('locale.config_manager');
  $names = $locale_config_manager->getComponentNames();
  $locale_config_manager->updateConfigTranslations($names, $langcodes);
  $this->configFactory = $this->container
    ->get('config.factory');
  $this->stringStorage = $this->container
    ->get('locale.storage');
  $this->localeConfigManager = $this->container
    ->get('locale.config_manager');
  $this->languageManager = $this->container
    ->get('language_manager');
  $this->setUpLocale();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.