You are here

protected function FeedsMapperNodeSummaryTestCase::createImporterWithSummaryMapper in Feeds 7.2

Creates an importer with a summary mapper.

Parameters

$name: The natural name of the feed.

$id: The persistent id of the feed.

Return value

void

1 call to FeedsMapperNodeSummaryTestCase::createImporterWithSummaryMapper()
FeedsMapperNodeSummaryTestCase::test in tests/feeds_mapper_summary.test
Tests importing CSV files for text fields with summary.

File

tests/feeds_mapper_summary.test, line 126
Contains FeedsMapperNodeSummaryTestCase.

Class

FeedsMapperNodeSummaryTestCase
Test case for mapping to node summary.

Code

protected function createImporterWithSummaryMapper($name = 'Syndication', $id = 'syndication') {

  // Create content type. A field named "body" which is of type "Long text and summary"
  // will be created by default, so we don't need to create a field of that type here.
  $typename = $this
    ->createContentType(array());

  // Create and configure importer.
  $this
    ->createImporterConfiguration($name, $id);
  $this
    ->setSettings('syndication', NULL, array(
    'content_type' => '',
    'import_period' => FEEDS_SCHEDULE_NEVER,
  ));
  $this
    ->setPlugin('syndication', 'FeedsFileFetcher');
  $this
    ->setPlugin('syndication', 'FeedsCSVParser');
  $this
    ->setSettings('syndication', 'FeedsNodeProcessor', array(
    'bundle' => $typename,
  ));
  $this
    ->addMappings('syndication', array(
    0 => array(
      'source' => 'title',
      'target' => 'title',
    ),
    1 => array(
      'source' => 'summary',
      'target' => 'body:summary',
    ),
    2 => array(
      'source' => 'body',
      'target' => 'body',
    ),
    3 => array(
      'source' => 'guid',
      'target' => 'guid',
      'unique' => TRUE,
    ),
  ));
}