public function FeedsMapperMultilingualFieldsTestCase::testAutocreatedTermLanguage in Feeds 7.2
Tests if autocreated terms are in the language that was set on the target configuration in case the taxonomy is multilingual.
File
- tests/
feeds_mapper_multilingual_fields.test, line 573 - Contains FeedsMapperMultilingualFieldsTestCase.
Class
- FeedsMapperMultilingualFieldsTestCase
- Tests field mapping with multiple languages.
Code
public function testAutocreatedTermLanguage() {
module_enable(array(
'i18n_taxonomy',
));
// Make sure that entity info is reset.
drupal_flush_all_caches();
drupal_static_reset();
// Enable multilingual taxonomy.
$edit = array(
'i18n_mode' => 4,
);
$this
->drupalPost('admin/structure/taxonomy/categories/edit', $edit, 'Save');
// Configure importer to import in French language.
$this
->setSettings('node', 'FeedsNodeProcessor', array(
'language' => 'fr',
));
$this
->addMappings('node', array(
2 => array(
'source' => 'term',
'target' => 'field_category',
'autocreate' => TRUE,
'field_language' => 'fr',
),
));
// Import French item.
$this
->importFile('node', $this
->absolutePath() . '/tests/feeds/multilingual_fr.csv');
$this
->assertText(t('Created 1 node'));
// Assert that the created term is in the French language.
$term = taxonomy_term_load(1);
$this
->assertEqual('fr', entity_language('taxonomy_term', $term));
}