You are here

protected function LocaleConfigSubscriberTest::deleteLocaleTranslationData in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php \Drupal\locale\Tests\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/src/Tests/LocaleConfigSubscriberForeignTest.php
Tests that adding English creates a translation override.
LocaleConfigSubscriberForeignTest::testLocaleDeleteActiveTranslation in core/modules/locale/src/Tests/LocaleConfigSubscriberForeignTest.php
Tests deleting community translations of shipped configuration.
LocaleConfigSubscriberTest::testLocaleDeleteTranslation in core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php
Tests deleting community translations of shipped configuration.

File

core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php, line 361
Contains \Drupal\locale\Tests\LocaleConfigSubscriberTest.

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\locale\Tests

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(array(
    $config_name,
  ), array(
    $langcode,
  ));
  $this->configFactory
    ->reset($config_name);
  $this
    ->assertNoConfigOverride($config_name, $key, $source_value, $langcode);
}