You are here

function ParserIcalLocationTestCase::testLocation in iCal feed parser 7.2

Basic test on simple ical file.

File

tests/parser_ical_location.test, line 23
Test case for CCK ical date field text mapper.

Class

ParserIcalLocationTestCase
Common class for testing ical parsers link and guid mapping.

Code

function testLocation() {

  // Create content type.
  $typename = $this
    ->createContentType(array(), array(
    'alpha' => 'text',
  ));
  $this
    ->createImporterConfiguration('iCal importer', 'ical');
  $this
    ->setSettings('ical', NULL, array(
    'content_type' => '',
    'import_period' => FEEDS_SCHEDULE_NEVER,
  ));
  $this
    ->setPlugin('ical', 'FeedsFileFetcher');
  $this
    ->setSettings('ical', 'FeedsFileFetcher', array(
    'allowed_extensions' => 'ics ical',
  ));
  $this
    ->configureParser();
  $this
    ->setSettings('ical', 'FeedsNodeProcessor', array(
    'content_type' => $typename,
  ));
  $this
    ->addMappings('ical', array(
    array(
      'source' => 'uid',
      'target' => 'guid',
    ),
    array(
      'source' => 'summary',
      'target' => 'title',
    ),
    array(
      'source' => 'location',
      'target' => 'field_alpha',
    ),
  ));

  // Import iCal file
  $this
    ->importFile('ical', $this
    ->absolutePath() . '/tests/feeds/location.ics');
  $this
    ->assertText('Created 3 nodes');
  $this
    ->locationAssertions();
}