public function LocaleUpdateTest::testUpdateImportModeNone in Drupal 8
Same name and namespace in other branches
- 9 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()
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 265
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
->drupalPostForm('admin/config/regional/translate/settings', $edit, t('Save configuration'));
// Execute translation update.
$this
->drupalGet('admin/reports/translations/check');
$this
->drupalPostForm('admin/reports/translations', [], t('Update translations'));
// Check whether existing translations have (not) been overwritten.
$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');
}