You are here

protected function InstallerTranslationMultipleLanguageTest::verifyImportedStringsTranslated in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php \Drupal\system\Tests\Installer\InstallerTranslationMultipleLanguageTest::verifyImportedStringsTranslated()

Helper function to verify that the expected strings are translated.

1 call to InstallerTranslationMultipleLanguageTest::verifyImportedStringsTranslated()
InstallerTranslationMultipleLanguageTest::testTranslationsLoaded in core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php
Tests that translations ended up at the expected places.

File

core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php, line 151
Contains \Drupal\system\Tests\Installer\InstallerTranslationMultipleLanguageTest.

Class

InstallerTranslationMultipleLanguageTest
Tests translation files for multiple languages get imported during install.

Namespace

Drupal\system\Tests\Installer

Code

protected function verifyImportedStringsTranslated() {
  $test_samples = [
    'Save and continue',
    'Anonymous',
    'Language',
  ];
  $langcodes = [
    'de',
    'es',
  ];
  foreach ($test_samples as $sample) {
    foreach ($langcodes as $langcode) {
      $edit = array();
      $edit['langcode'] = $langcode;
      $edit['translation'] = 'translated';
      $edit['string'] = $sample;
      $this
        ->drupalPostForm('admin/config/regional/translate', $edit, t('Filter'));
      $this
        ->assertText($sample . ' ' . $langcode);
    }
  }
}