diff --git a/core/modules/views_ui/src/Tests/TranslatedStringsTest.php b/core/modules/views_ui/src/Tests/TranslatedStringsTest.php new file mode 100644 index 0000000..59c358d --- /dev/null +++ b/core/modules/views_ui/src/Tests/TranslatedStringsTest.php @@ -0,0 +1,89 @@ +adminUser = $this->drupalCreateUser($permissions); + $this->drupalLogin($this->adminUser); + + // Add languages. + foreach ($this->langcodes as $langcode) { + ConfigurableLanguage::createFromLangcode($langcode)->save(); + } + $this->resetAll(); + $this->rebuildContainer(); + } + + public function testTranslatedStrings() { + $translation_url = 'admin/structure/views/view/files/translate/fr/add'; + $edit_url = 'admin/structure/views/view/files'; + + // Check origial string. + $this->drupalGet($edit_url); + $this->assertTitle('Files (File) | Drupal'); + + // Translate the label of the view. + $this->drupalGet($translation_url); + $edit = [ + 'translation[config_names][views.view.files][label]' => 'Fichiers', + ]; + $this->drupalPostForm(NULL, $edit, t('Save translation')); + + // Check if the label is translated. + $this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]); + $this->assertTitle('Files (File) | Drupal'); + $this->assertNoText('Fichiers'); + } + +}