public function TranslatedViewTest::testTranslatedStrings in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php \Drupal\Tests\views_ui\Functional\TranslatedViewTest::testTranslatedStrings()
- 10 core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php \Drupal\Tests\views_ui\Functional\TranslatedViewTest::testTranslatedStrings()
File
- core/
modules/ views_ui/ tests/ src/ Functional/ TranslatedViewTest.php, line 67
Class
- TranslatedViewTest
- Tests that translated strings in views UI don't override original strings.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testTranslatedStrings() {
$translation_url = 'admin/structure/views/view/files/translate/fr/add';
$edit_url = 'admin/structure/views/view/files';
// Check the original string.
$this
->drupalGet($edit_url);
$this
->assertSession()
->titleEquals('Files (File) | Drupal');
// Translate the label of the view.
$this
->drupalGet($translation_url);
$edit = [
'translation[config_names][views.view.files][label]' => 'Fichiers',
];
$this
->submitForm($edit, 'Save translation');
// Check if the label is translated.
$this
->drupalGet($edit_url, [
'language' => \Drupal::languageManager()
->getLanguage('fr'),
]);
$this
->assertSession()
->titleEquals('Files (File) | Drupal');
$this
->assertSession()
->pageTextNotContains('Fichiers');
}