You are here

public function FeedsRSStoNodesTest::testPushImportWithCSV in Feeds 7.2

Tests the FeedsSource::pushImport() method with a CSV file.

File

tests/feeds_processor_node.test, line 921
Tests for plugins/FeedsNodeProcessor.inc.

Class

FeedsRSStoNodesTest
Test aggregating a feed as node items.

Code

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());
}