protected function LocaleConfigSubscriberTest::saveLanguageOverride in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php \Drupal\locale\Tests\LocaleConfigSubscriberTest::saveLanguageOverride()
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.
3 calls to LocaleConfigSubscriberTest::saveLanguageOverride()
- LocaleConfigSubscriberForeignTest::testEnglish in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberForeignTest.php - Tests that adding English creates a translation override.
- LocaleConfigSubscriberTest::testCreateTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php - Tests creating translations of shipped configuration.
- LocaleConfigSubscriberTest::testUpdateTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php - Tests updating translations of shipped configuration.
File
- core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php, line 261 - Contains \Drupal\locale\Tests\LocaleConfigSubscriberTest.
Class
- LocaleConfigSubscriberTest
- Tests that shipped configuration translations are updated correctly.
Namespace
Drupal\locale\TestsCode
protected function saveLanguageOverride($config_name, $key, $value, $langcode) {
$translation_override = $this->languageManager
->getLanguageConfigOverride($langcode, $config_name);
$translation_override
->set($key, $value)
->save();
$this->configFactory
->reset($config_name);
$this
->assertConfigOverride($config_name, $key, $value, $langcode);
}