function LocaleConfigSubscriberTest::deleteLocaleTranslationData

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

Deletes 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_value: The source configuration value to verify the correct value is returned from the configuration factory after the deletion.

string $langcode: The language code.

3 calls to LocaleConfigSubscriberTest::deleteLocaleTranslationData()
LocaleConfigSubscriberForeignTest::testEnglish in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests that adding English creates a translation override.
LocaleConfigSubscriberForeignTest::testLocaleDeleteActiveTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests deleting community translations of shipped configuration.
LocaleConfigSubscriberTest::testLocaleDeleteTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
Tests deleting community translations of shipped configuration.

File

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

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\Tests\locale\Kernel

Code

protected function deleteLocaleTranslationData($config_name, $key, $source_value, $langcode) {
    $this->localeConfigManager
        ->getStringTranslation($config_name, $langcode, $source_value, '')
        ->delete();
    $this->localeConfigManager
        ->reset();
    $this->localeConfigManager
        ->updateConfigTranslations([
        $config_name,
    ], [
        $langcode,
    ]);
    $this->configFactory
        ->reset($config_name);
    $this->assertNoConfigOverride($config_name, $key);
}

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