You are here

protected function LocaleConfigSubscriberTest::deleteLanguageOverride in Drupal 8

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

Deletes 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 $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.

2 calls to LocaleConfigSubscriberTest::deleteLanguageOverride()
LocaleConfigSubscriberForeignTest::testDeleteTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests deleting a translation override.
LocaleConfigSubscriberTest::testDeleteTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
Tests deleting translations of shipped configuration.

File

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

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\Tests\locale\Kernel

Code

protected function deleteLanguageOverride($config_name, $key, $source_value, $langcode) {
  $translation_override = $this->languageManager
    ->getLanguageConfigOverride($langcode, $config_name);
  $translation_override
    ->clear($key)
    ->save();
  $this->configFactory
    ->reset($config_name);
  $this
    ->assertNoConfigOverride($config_name, $key, $source_value, $langcode);
}