You are here

public function L10nUpdateTest::testUpdateImportModeNone in Localization update 7.2

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

tests/L10nUpdateTest.test, line 281
Contains L10nUpdateTest.

Class

L10nUpdateTest
Tests for update translations.

Code

public function testUpdateImportModeNone() {

  // Build the test environment.
  $this
    ->setTranslationFiles();
  $this
    ->setCurrentTranslations();
  variable_set('l10n_update_default_filename', '%project-%release.%language._po');

  // Set the test conditions.
  $edit = array(
    'l10n_update_check_mode' => L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL,
    'l10n_update_import_mode' => LOCALE_IMPORT_KEEP,
  );
  $this
    ->drupalPost('admin/config/regional/language/update', $edit, t('Save configuration'));

  // Execute translation update.
  $this
    ->drupalGet('admin/config/regional/translate/check');
  $this
    ->drupalPost('admin/config/regional/translate/update', 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');
}