3 namespace Drupal\Tests\views_ui\Functional;
5 use Drupal\language\Entity\ConfigurableLanguage;
8 * Tests that translated strings in views UI don't override original strings.
12 class TranslatedViewTest extends UITestBase {
19 public static $modules = [
25 * Languages to enable.
29 protected $langcodes = [
34 * Administrator user for tests.
36 * @var \Drupal\user\UserInterface
40 protected function setUp($import_test_views = TRUE) {
41 parent::setUp($import_test_views);
44 'administer site configuration',
46 'translate configuration',
47 'translate interface',
50 // Create and log in user.
51 $this->adminUser = $this->drupalCreateUser($permissions);
52 $this->drupalLogin($this->adminUser);
55 foreach ($this->langcodes as $langcode) {
56 ConfigurableLanguage::createFromLangcode($langcode)->save();
59 $this->rebuildContainer();
62 public function testTranslatedStrings() {
63 $translation_url = 'admin/structure/views/view/files/translate/fr/add';
64 $edit_url = 'admin/structure/views/view/files';
66 // Check origial string.
67 $this->drupalGet($edit_url);
68 $this->assertTitle('Files (File) | Drupal');
70 // Translate the label of the view.
71 $this->drupalGet($translation_url);
73 'translation[config_names][views.view.files][label]' => 'Fichiers',
75 $this->drupalPostForm(NULL, $edit, t('Save translation'));
77 // Check if the label is translated.
78 $this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]);
79 $this->assertTitle('Files (File) | Drupal');
80 $this->assertNoText('Fichiers');