public function LocaleUpdateTest::testUpdateImportModeNone in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/src/Tests/LocaleUpdateTest.php \Drupal\locale\Tests\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/ src/ Tests/ LocaleUpdateTest.php, line 275 - Contains \Drupal\locale\Tests\LocaleUpdateTest.
Class
- LocaleUpdateTest
- Tests for updating the interface translations of projects.
Namespace
Drupal\locale\TestsCode
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 = array(
'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', array(), 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');
}