8.5.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = [])
8.0.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = array())
8.1.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = array())
8.2.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = array())
8.3.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = [])
8.4.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = [])
8.6.x LocaleImportFunctionalTest.php LocaleImportFunctionalTest::importPoFile($contents, array $options = [])
7.x locale.test LocaleImportFunctionalTest::importPoFile($contents, array $options = array())

Helper function: import a standalone .po file in a given language.

Parameters

$contents: Contents of the .po file to import.

$options: Additional options to pass to the translation import form.

3 calls to LocaleImportFunctionalTest::importPoFile()
LocaleImportFunctionalTest::testEmptyMsgstr in modules/locale/locale.test
Test empty msgstr at end of .po file see #611786.
LocaleImportFunctionalTest::testLanguageContext in modules/locale/locale.test
Test msgctxt context support.
LocaleImportFunctionalTest::testStandalonePoFile in modules/locale/locale.test
Test import of standalone .po files.

File

modules/locale/locale.test, line 1115
Tests for locale.module.

Class

LocaleImportFunctionalTest
Functional tests for the import of translation files.

Code

function importPoFile($contents, array $options = array()) {
  $name = drupal_tempnam('temporary://', "po_") . '.po';
  file_put_contents($name, $contents);
  $options['files[file]'] = $name;
  $this
    ->drupalPost('admin/config/regional/translate/import', $options, t('Import'));
  drupal_unlink($name);
}