You are here

public function LocaleConfigSubscriberTest::testCreateTranslationMultiValue 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::testCreateTranslationMultiValue()

Tests creating translations configuration with multi value settings.

File

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

Class

LocaleConfigSubscriberTest
Tests that shipped configuration translations are updated correctly.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testCreateTranslationMultiValue() {
  $config_name = 'locale_test.translation_multiple';
  $this
    ->saveLanguageOverride($config_name, 'test_multiple', [
    'string' => 'String (German)',
    'another_string' => 'Another string (German)',
  ], 'de');
  $this
    ->saveLanguageOverride($config_name, 'test_after_multiple', [
    'string' => 'After string (German)',
    'another_string' => 'After another string (German)',
  ], 'de');
  $strings = $this->stringStorage
    ->getTranslations([
    'type' => 'configuration',
    'name' => $config_name,
    'language' => 'de',
    'translated' => TRUE,
  ]);
  $this
    ->assertCount(5, $strings);
}