You are here

public function ParserIcalFeedsTestCase::createConfiguredFeed in iCal feed parser 6.2

Same name and namespace in other branches
  1. 7 tests/parser_ical_feeds.test \ParserIcalFeedsTestCase::createConfiguredFeed()

Basic test configured feed item, to import feed into.

2 calls to ParserIcalFeedsTestCase::createConfiguredFeed()
ParserIcalFeedsDateTestCase::testBasicFeed in tests/parser_ical_feeds.test
Basic test using Basic.ics
ParserIcalFeedsLocationTestCase::createConfiguredFeed in tests/parser_ical_feeds.test
Basic test configured feed item, to import feed into.
1 method overrides ParserIcalFeedsTestCase::createConfiguredFeed()
ParserIcalFeedsLocationTestCase::createConfiguredFeed in tests/parser_ical_feeds.test
Basic test configured feed item, to import feed into.

File

tests/parser_ical_feeds.test, line 54

Class

ParserIcalFeedsTestCase
Class for testing Feeds <em>content</em> mapper.

Code

public function createConfiguredFeed($fields = array()) {

  // Create content type.
  $fields = array_merge($fields, array(
    'datefield' => array(
      'type' => 'date',
      'settings' => array(
        'todate' => 'optional',
        'tz_handling' => 'date',
      ),
    ),
    'datesite' => array(
      'type' => 'date',
      'settings' => array(
        'todate' => 'optional',
        'tz_handling' => 'site',
      ),
    ),
  ));
  $typename = $this
    ->createContentType(NULL, $fields);

  // Create and configure importer.
  $this
    ->createFeedConfiguration('iCal Feed', 'ical');
  $this
    ->setSettings('ical', NULL, array(
    'content_type' => '',
    'import_period' => FEEDS_SCHEDULE_NEVER,
  ));
  $this
    ->setPlugin('ical', 'FeedsFileFetcher');
  $this
    ->setPlugin('ical', 'ParserIcalFeedsParser');
  $this
    ->setSettings('ical', 'FeedsNodeProcessor', array(
    'content_type' => $typename,
    'update_existing' => 1,
  ));
  $this
    ->addMappings('ical', array(
    array(
      'source' => 'title',
      'target' => 'title',
    ),
    array(
      'source' => 'description',
      'target' => 'body',
    ),
    array(
      'source' => 'ical_date',
      'target' => 'field_datefield:start',
    ),
    array(
      'source' => 'ical_date',
      'target' => 'field_datesite:start',
    ),
    array(
      'source' => 'guid',
      'target' => 'guid',
      'unique' => '1',
    ),
  ));
  return $typename;
}