function LocaleExportFunctionalTest::testExportTranslation in Drupal 7
Test exportation of translations.
File
- modules/
locale/ locale.test, line 1340 - Tests for locale.module.
Class
- LocaleExportFunctionalTest
- Functional tests for the export of translation files.
Code
function testExportTranslation() {
// First import some known translations.
// This will also automatically enable the 'fr' language.
$name = drupal_tempnam('temporary://', "po_") . '.po';
file_put_contents($name, $this
->getPoFile());
$this
->drupalPost('admin/config/regional/translate/import', array(
'langcode' => 'fr',
'files[file]' => $name,
), t('Import'));
drupal_unlink($name);
// Get the French translations.
$this
->drupalPost('admin/config/regional/translate/export', array(
'langcode' => 'fr',
), t('Export'));
// Ensure we have a translation file.
$this
->assertRaw('# French translation of Drupal', 'Exported French translation file.');
// Ensure our imported translations exist in the file.
$this
->assertRaw('msgstr "lundi"', 'French translations present in exported file.');
}