Skip to content
Snippets Groups Projects
Commit dd038fe1 authored by grahamC's avatar grahamC Committed by MegaChriz
Browse files

Issue #2624344 by grahamC, MegaChriz: Import via pushImport() keeps looping / never completes

parent ef02afd2
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ class FeedsState {
$this->progress = FEEDS_BATCH_COMPLETE;
}
elseif ($total) {
$this->progress = $progress / $total;
$this->progress = (float) $progress / $total;
if ($this->progress == FEEDS_BATCH_COMPLETE && $total != $progress) {
$this->progress = 0.99;
}
......
......@@ -668,6 +668,26 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$this->assertEqual(10, db_query("SELECT COUNT(*) FROM {node}")->fetchField());
}
/**
* Tests the FeedsSource::pushImport() method with a CSV file.
*/
public function testPushImportWithCSV() {
// Attach to standalone importer and configure.
$this->setSettings('syndication', NULL, array('content_type' => ''));
$this->setPlugin('syndication', 'FeedsCSVParser');
$this->removeMappings('syndication', $this->getCurrentMappings('syndication'));
$this->addMappings('syndication', array(
0 => array(
'source' => 'title',
'target' => 'title',
),
));
$raw = file_get_contents($this->absolutePath() . '/tests/feeds/many_nodes.csv');
feeds_source('syndication', 0)->pushImport(new FeedsFetcherResult($raw));
$this->assertEqual(86, db_query("SELECT COUNT(*) FROM {node}")->fetchField());
}
/**
* Tests if target item is not updated when only non-mapped data on the source changed.
*/
......
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