function LocalePluralFormatTest::importPoFile

Imports 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.

2 calls to LocalePluralFormatTest::importPoFile()
LocalePluralFormatTest::testGetPluralFormat in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
Tests locale_get_plural() and format_plural() functionality.
LocalePluralFormatTest::testPluralEditExport in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php
Tests plural editing and export functionality.

File

drupal/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php, line 269
Definition of Drupal\locale\Tests\LocalePluralFormatTest.

Class

LocalePluralFormatTest
Tests plural format handling functionality.

Namespace

Drupal\locale\Tests

Code

function importPoFile($contents, array $options = array()) {
  $name = 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);
}