function ConfigTranslationUiTest::testSequenceTranslation
Same name in other branches
- 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSequenceTranslation()
- 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSequenceTranslation()
- 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSequenceTranslation()
Tests the sequence data type translation.
File
-
core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php, line 907
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalCode
public function testSequenceTranslation() {
$this->drupalLogin($this->adminUser);
/** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
$config_factory = $this->container
->get('config.factory');
$expected = [
'kitten',
'llama',
'elephant',
];
$actual = $config_factory->getEditable('config_translation_test.content')
->get('animals');
$this->assertEqual($expected, $actual);
$edit = [
'translation[config_names][config_translation_test.content][content][value]' => '<p><strong>Hello World</strong> - FR</p>',
'translation[config_names][config_translation_test.content][animals][0]' => 'kitten - FR',
'translation[config_names][config_translation_test.content][animals][1]' => 'llama - FR',
'translation[config_names][config_translation_test.content][animals][2]' => 'elephant - FR',
];
$this->drupalPostForm('admin/config/media/file-system/translate/fr/add', $edit, t('Save translation'));
$this->container
->get('language.config_factory_override')
->setLanguage(new Language([
'id' => 'fr',
]));
$expected = [
'kitten - FR',
'llama - FR',
'elephant - FR',
];
$actual = $config_factory->get('config_translation_test.content')
->get('animals');
$this->assertEqual($expected, $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.