protected function LocaleConfigSubscriberTest::saveLocaleTranslationData in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php \Drupal\locale\Tests\LocaleConfigSubscriberTest::saveLocaleTranslationData()
Saves translation data from locale module.
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 $source: The source string.
string $translation: The translation string to save.
string $langcode: The language code.
bool $is_active: Whether the update will affect the active configuration.
5 calls to LocaleConfigSubscriberTest::saveLocaleTranslationData()
- LocaleConfigSubscriberForeignTest::testEnglish in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberForeignTest.php - Tests that adding English creates a translation override.
- LocaleConfigSubscriberForeignTest::testLocaleCreateActiveTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberForeignTest.php - Tests importing community translations of shipped configuration.
- LocaleConfigSubscriberForeignTest::testLocaleUpdateActiveTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberForeignTest.php - Tests updating community translations of shipped configuration.
- LocaleConfigSubscriberTest::testLocaleCreateTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php - Tests importing community translations of shipped configuration.
- LocaleConfigSubscriberTest::testLocaleUpdateTranslation in core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php - Tests updating community translations of shipped configuration.
File
- core/
modules/ locale/ src/ Tests/ LocaleConfigSubscriberTest.php, line 294 - Contains \Drupal\locale\Tests\LocaleConfigSubscriberTest.
Class
- LocaleConfigSubscriberTest
- Tests that shipped configuration translations are updated correctly.
Namespace
Drupal\locale\TestsCode
protected function saveLocaleTranslationData($config_name, $key, $source, $translation, $langcode, $is_active = FALSE) {
$this->localeConfigManager
->reset();
$this->localeConfigManager
->getStringTranslation($config_name, $langcode, $source, '')
->setString($translation)
->save();
$this->localeConfigManager
->reset();
$this->localeConfigManager
->updateConfigTranslations(array(
$config_name,
), array(
$langcode,
));
$this->configFactory
->reset($config_name);
if ($is_active) {
$this
->assertActiveConfig($config_name, $key, $translation, $langcode);
}
else {
$this
->assertConfigOverride($config_name, $key, $translation, $langcode);
}
}