function LocaleExportFunctionalTest::testExportTranslation
7.x locale.test | LocaleExportFunctionalTest::testExportTranslation() |
Test exportation of translations.
File
- drupal-7.x/
modules/ locale/ locale.test, line 1330 - 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 = 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.');
}