function LocaleFileImportStatus::testBulkImportNotUpdateExisting

Don't update a pre-existing file.

File

drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php, line 162
Definition of Drupal\locale\Tests\LocaleFileImportStatus.

Class

LocaleFileImportStatus
Functional tests for the import of translation files.

Namespace

Drupal\locale\Tests

Code

function testBulkImportNotUpdateExisting() {
  $langcode = 'de';

  // Translations should not exist.
  $strings = array(
    'Monday' => '',
    'Tuesday' => '',
  );
  $this
    ->checkTranslations($strings, $langcode);

  // Fill the {locale_file} table with a newer file.
  $file = $this
    ->mockImportedPoFile($langcode, 1);

  // Add language.
  $this
    ->addLanguage($langcode);

  // The file was not imported, the translation should not exist.
  $strings = array(
    'Monday' => '',
    'Tuesday' => '',
  );
  $this
    ->checkTranslations($strings, $langcode);
  $timestamp = db_query('SELECT timestamp FROM {locale_file} WHERE uri = :uri', array(
    ':uri' => $file->uri,
  ))
    ->fetchField();
  $this
    ->assertEqual($timestamp, $file->timestamp);
}