function LocaleImportFunctionalTest::testEmptyMsgstr

Test empty msgstr at end of .po file see #611786.

File

drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php, line 212
Definition of Drupal\locale\Tests\LocaleImportFunctionalTest.

Class

LocaleImportFunctionalTest
Functional tests for the import of translation files.

Namespace

Drupal\locale\Tests

Code

function testEmptyMsgstr() {
  $langcode = 'hu';

  // Try importing a .po file.
  $this
    ->importPoFile($this
    ->getPoFileWithMsgstr(), array(
    'langcode' => $langcode,
  ));
  $this
    ->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array(
    '%number' => 1,
    '%update' => 0,
    '%delete' => 0,
  )), t('The translation file was successfully imported.'));
  $this
    ->assertIdentical(t('Operations', array(), array(
    'langcode' => $langcode,
  )), 'Műveletek', t('String imported and translated.'));

  // Try importing a .po file.
  $this
    ->importPoFile($this
    ->getPoFileWithEmptyMsgstr(), array(
    'langcode' => $langcode,
    'overwrite_options[not_customized]' => TRUE,
  ));
  $this
    ->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array(
    '%number' => 0,
    '%update' => 0,
    '%delete' => 1,
  )), t('The translation file was successfully imported.'));
  $str = "Operations";
  $search = array(
    'string' => $str,
    'langcode' => $langcode,
    'translation' => 'untranslated',
  );
  $this
    ->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
  $this
    ->assertText($str, t('Search found the string as untranslated.'));
}