Skip to content
Snippets Groups Projects
Commit bf490636 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #2174303 by twistor | bdanin: Feeds importer importer -- context and mapping not working.

parent 95cc7449
No related branches found
No related tags found
No related merge requests found
......@@ -1185,6 +1185,7 @@ function feeds_ui_importer_import_submit($form, &$form_state) {
$save = feeds_importer($importer->id);
$save->setConfig($importer->config);
foreach (array('fetcher', 'parser', 'processor') as $type) {
$save->setPlugin($importer->config[$type]['plugin_key']);
$save->$type->setConfig($importer->config[$type]['config']);
}
$save->save();
......
......@@ -17,6 +17,10 @@ class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase {
);
}
public function setUp() {
parent::setUp(array('php'), array('use PHP for settings'));
}
/**
* UI functionality tests on
* feeds_ui_overview(),
......@@ -111,4 +115,46 @@ class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase {
// @todo Refreshing/deleting feed items. Needs to live in feeds.test
}
public function testImporterImport() {
$name = $this->randomString();
$id = drupal_strtolower($this->randomName());
$this->createImporterConfiguration($name, $id);
$this->setPlugin($id, 'FeedsCSVParser');
$this->setPlugin($id, 'FeedsFileFetcher');
$this->setPlugin($id, 'FeedsTermProcessor');
$this->setSettings($id, 'FeedsFileFetcher', array('allowed_extensions' => 'xml'));
$this->setSettings($id, 'FeedsCSVParser', array('delimiter' => '|'));
$this->setSettings($id, 'FeedsUserProcessor', array('skip_hash_check' => TRUE));
$this->drupalGet('admin/structure/feeds/' . $id . '/export');
$export = $this->xpath('//textarea[1]/text()');
$export = (string) $export[0];
// Delete this importer.
$this->drupalPost('admin/structure/feeds/' . $id . '/delete', array(), t('Delete'));
// Try to import.
$this->drupalPost('admin/structure/feeds/import', array('importer' => $export), t('Import'));
$this->assertText("Successfully imported the $id feeds importer.");
// Check that the settings are correct.
$importer = feeds_importer($id);
$this->assertEqual('FeedsFileFetcher', get_class($importer->fetcher));
$this->assertEqual('FeedsCSVParser', get_class($importer->parser));
$this->assertEqual('FeedsTermProcessor', get_class($importer->processor));
$config = $importer->fetcher->getConfig();
$this->assertEqual('xml', $config['allowed_extensions']);
$config = $importer->parser->getConfig();
$this->assertEqual('|', $config['delimiter']);
$config = $importer->processor->getConfig();
$this->assertTrue($config['skip_hash_check']);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment