function LocaleUpdateTest::testUpdateImportModeNone
Same name in other branches
- 8.9.x core/modules/locale/tests/src/Functional/LocaleUpdateTest.php \Drupal\Tests\locale\Functional\LocaleUpdateTest::testUpdateImportModeNone()
- 10 core/modules/locale/tests/src/Functional/LocaleUpdateTest.php \Drupal\Tests\locale\Functional\LocaleUpdateTest::testUpdateImportModeNone()
- 11.x core/modules/locale/tests/src/Functional/LocaleUpdateTest.php \Drupal\Tests\locale\Functional\LocaleUpdateTest::testUpdateImportModeNone()
Tests translation import and don't overwrite any translation.
Test conditions:
- Source: remote and local files
- Import overwrite: don't overwrite any existing translation
File
-
core/
modules/ locale/ tests/ src/ Functional/ LocaleUpdateTest.php, line 285
Class
- LocaleUpdateTest
- Tests for updating the interface translations of projects.
Namespace
Drupal\Tests\locale\FunctionalCode
public function testUpdateImportModeNone() {
$config = $this->config('locale.settings');
// Build the test environment.
$this->setTranslationFiles();
$this->setCurrentTranslations();
$config->set('translation.default_filename', '%project-%version.%language._po');
// Set the test conditions.
$edit = [
'use_source' => LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL,
'overwrite' => LOCALE_TRANSLATION_OVERWRITE_NONE,
];
$this->drupalGet('admin/config/regional/translate/settings');
$this->submitForm($edit, 'Save configuration');
// Execute translation update.
$this->drupalGet('admin/reports/translations/check');
$this->drupalGet('admin/reports/translations');
$this->submitForm([], 'Update translations');
// Check whether existing translations have (not) been overwritten.
// cSpell:disable
$this->assertTranslation('January', 'Januar_customized', 'de');
$this->assertTranslation('February', 'Februar_customized', 'de');
$this->assertTranslation('March', 'Marz', 'de');
$this->assertTranslation('April', 'April_2', 'de');
$this->assertTranslation('May', 'Mai_customized', 'de');
$this->assertTranslation('June', 'Juni', 'de');
$this->assertTranslation('Monday', 'Montag', 'de');
// cSpell:enable
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.