function LocaleConfigSubscriberTest::assertConfigOverride

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

Ensures configuration was saved correctly.

@internal

Parameters

string $config_name: The configuration name.

string $key: The configuration key.

string|array $value: The configuration value.

string $langcode: The language code.

4 calls to LocaleConfigSubscriberTest::assertConfigOverride()
LocaleConfigSubscriberForeignTest::testEnglish in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php
Tests that adding English creates a translation override.
LocaleConfigSubscriberTest::saveLanguageOverride in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
Saves a language override.
LocaleConfigSubscriberTest::saveLocaleTranslationData in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
Saves translation data from locale module.
LocaleConfigSubscriberTest::setUpTranslation in core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
Sets up a configuration string with a translation.

File

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

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\Tests\locale\Kernel

Code

protected function assertConfigOverride(string $config_name, string $key, $value, string $langcode) : void {
    $config_langcode = $this->configFactory
        ->getEditable($config_name)
        ->get('langcode');
    $override = $this->languageManager
        ->getLanguageConfigOverride($langcode, $config_name);
    $this->assertNotEquals($langcode, $config_langcode);
    $this->assertEquals($value, $override->get($key));
}

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