You are here

protected function LocaleConfigSubscriberForeignTest::saveLanguageActive in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberForeignTest::saveLanguageActive()

Saves a language override.

This will invoke LocaleConfigSubscriber through the event dispatcher. To make sure the configuration was persisted correctly, the configuration value is checked. Because LocaleConfigSubscriber temporarily disables the override state of the configuration factory we check that the correct value is restored afterwards.

Parameters

string $config_name: The configuration name.

string $key: The configuration key.

string $value: The configuration value to save.

string $langcode: The language code.

2 calls to LocaleConfigSubscriberForeignTest::saveLanguageActive()
LocaleConfigSubscriberForeignTest::testCreateActiveTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests creating translations of shipped configuration.
LocaleConfigSubscriberForeignTest::testUpdateActiveTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests updating translations of shipped configuration.

File

core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php, line 159

Class

LocaleConfigSubscriberForeignTest
Tests default configuration handling with a foreign default language.

Namespace

Drupal\Tests\locale\Kernel

Code

protected function saveLanguageActive($config_name, $key, $value, $langcode) {
  $this->configFactory
    ->getEditable($config_name)
    ->set($key, $value)
    ->save();
  $this
    ->assertActiveConfig($config_name, $key, $value, $langcode);
}