You are here

protected function InstallerTranslationMultipleLanguageTest::verifyImportedStringsTranslated in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationMultipleLanguageTest::verifyImportedStringsTranslated()

Helper function to verify that the expected strings are translated.

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

File

core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php, line 168

Class

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

Namespace

Drupal\FunctionalTests\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 = [];
      $edit['langcode'] = $langcode;
      $edit['translation'] = 'translated';
      $edit['string'] = $sample;
      $this
        ->drupalGet('admin/config/regional/translate');
      $this
        ->submitForm($edit, 'Filter');
      $this
        ->assertSession()
        ->pageTextContains($sample . ' ' . $langcode);
    }
  }
}