public function FeedsMapperMultilingualFieldsTestCase::testDisabledLanguage in Feeds 7.2
Tests if fields are imported in LANGUAGE_NONE if the field's language gets disabled after configuring.
File
- tests/
feeds_mapper_multilingual_fields.test, line 499 - Contains FeedsMapperMultilingualFieldsTestCase.
Class
- FeedsMapperMultilingualFieldsTestCase
- Tests field mapping with multiple languages.
Code
public function testDisabledLanguage() {
// Configure importer to import in French language.
$this
->setSettings('node', 'FeedsNodeProcessor', array(
'language' => 'fr',
));
$this
->addMappings('node', $this
->getMappingsInLanguage('fr'));
// Now disable the French language.
$path = 'admin/config/regional/language';
$edit = array(
'enabled[fr]' => FALSE,
);
$this
->drupalPost($path, $edit, t('Save configuration'));
// Reset static cache to update the available languages.
drupal_static_reset();
// Ensure no error messages are shown on the mappings page.
$this
->drupalGet('admin/structure/feeds/node/mapping');
// Import content.
$this
->importFile('node', $this
->absolutePath() . '/tests/feeds/multilingual_fr.csv');
$this
->assertText(t('Created 1 node'));
// Assert that the fields were all created in LANGUAGE_NONE.
$node = node_load(1, NULL, TRUE);
$french = $this
->getFrenchValues($node, LANGUAGE_NONE) + array(
'field_category' => array(
'expected' => 1,
'actual' => $node->field_category[LANGUAGE_NONE][0]['tid'],
),
);
foreach ($french as $field_name => $value) {
$this
->assertEqual($value['expected'], $value['actual'], format_string('The field %field has the expected value (actual: @actual).', array(
'%field' => $field_name,
'@actual' => $value['actual'],
)));
}
}