function LocaleImportFunctionalTest::setUp
Same name in other branches
- 7.x modules/locale/locale.test \LocaleImportFunctionalTest::setUp()
- 9 core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::setUp()
- 8.9.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::setUp()
- 11.x core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php \Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ locale/ tests/ src/ Functional/ LocaleImportFunctionalTest.php, line 49
Class
- LocaleImportFunctionalTest
- Tests the import of locale files.
Namespace
Drupal\Tests\locale\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Copy test po files to the translations directory.
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
$file_system->copy(__DIR__ . '/../../../tests/test.de.po', 'translations://', FileExists::Replace);
$file_system->copy(__DIR__ . '/../../../tests/test.xx.po', 'translations://', FileExists::Replace);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
]);
$this->adminUserAccessSiteReports = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
'access site reports',
]);
$this->drupalLogin($this->adminUser);
// Enable import of translations. By default this is disabled for automated
// tests.
$this->config('locale.settings')
->set('translation.import_enabled', TRUE)
->set('translation.use_source', LOCALE_TRANSLATION_USE_SOURCE_LOCAL)
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.