function LocaleFileSystemFormTest::testFileConfigurationPage
Same name and namespace in other branches
- 10 core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest::testFileConfigurationPage()
- 11.x core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest::testFileConfigurationPage()
- 9 core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest::testFileConfigurationPage()
- 8.9.x core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest::testFileConfigurationPage()
Tests translation directory settings on the file settings form.
Attributes
#[IgnoreDeprecations]
File
-
core/
modules/ locale/ tests/ src/ Functional/ LocaleFileSystemFormTest.php, line 41
Class
- LocaleFileSystemFormTest
- Tests the locale functionality in the altered file settings form.
Namespace
Drupal\Tests\locale\FunctionalCode
public function testFileConfigurationPage() : void {
// By default there should be no setting for the translation directory.
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->elementNotExists('css', '.form-item-translation-path');
// With locale module installed, the setting should appear.
$module_installer = $this->container
->get('module_installer');
$module_installer->install([
'locale',
]);
$this->rebuildContainer();
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->elementExists('css', '.form-item-translation-path');
// The setting should be reported correctly.
$translation_path = $this->publicFilesDirectory . '/translations_changed';
$settings['settings']['locale_translation_path'] = (object) [
'value' => $this->publicFilesDirectory . '/translations_changed',
'required' => TRUE,
];
$this->writeSettings($settings);
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->elementContains('css', '.form-item-translation-path', $translation_path);
// If set, the config is preferred over the setting.
// @todo remove this part when BC support for the config is removed.
$translation_path_config = $this->publicFilesDirectory . '/translations_changed_config';
$this->config('locale.settings')
->set('translation.path', $translation_path_config)
->save();
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->elementContains('css', '.form-item-translation-path', $translation_path_config);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.