diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index bb03d0ed99fd41527a6d8b773ed680fc302775df..8349b31278f745fdf9aff4cf3488a18e68096e40 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -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; } diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test index c72cff29912f8e321d0246570b144d399f1fb891..8c1893a970ba7a8a950b20d48a1753609f42a82c 100644 --- a/tests/feeds_processor_node.test +++ b/tests/feeds_processor_node.test @@ -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. */