You are here

public function ConfigTranslationUiTest::testSequenceTranslation in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php \Drupal\config_translation\Tests\ConfigTranslationUiTest::testSequenceTranslation()

Tests the sequence data type translation.

File

core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php, line 835
Contains \Drupal\config_translation\Tests\ConfigTranslationUiTest.

Class

ConfigTranslationUiTest
Translate settings and entities to various languages.

Namespace

Drupal\config_translation\Tests

Code

public function testSequenceTranslation() {
  $this
    ->drupalLogin($this->adminUser);

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
  $config_factory = $this->container
    ->get('config.factory');
  $expected = array(
    'kitten',
    'llama',
    'elephant',
  );
  $actual = $config_factory
    ->getEditable('config_translation_test.content')
    ->get('animals');
  $this
    ->assertEqual($expected, $actual);
  $edit = array(
    '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(array(
    'id' => 'fr',
  )));
  $expected = array(
    'kitten - FR',
    'llama - FR',
    'elephant - FR',
  );
  $actual = $config_factory
    ->get('config_translation_test.content')
    ->get('animals');
  $this
    ->assertEqual($expected, $actual);
}