function ParserIcalTextTestCase::test in iCal feed parser 7.2
Basic test on simple ical file.
File
- tests/
parser_ical_text.test, line 15 - Test case for CCK ical date field text mapper.
Class
- ParserIcalTextTestCase
- Common class for testing ical parsers text mapping.
Code
function test() {
// 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' => 'summary',
'target' => 'title',
),
array(
'source' => 'description',
'target' => 'body',
),
));
// Import iCal file
$this
->importFile('ical', $this
->absolutePath() . '/tests/feeds/basic.ics');
$this
->assertText('Created 2 nodes');
$this
->drupalGet('node/1/edit');
$this
->assertFieldByName('title', 'Only a short title (with no DESCRIPTION)', 'Feed item 1 title correct.');
$this
->drupalGet('node/2/edit');
$this
->assertFieldByName('title', 'This has a long description wrapped and escaped', 'Feed item 2 title correct.');
$body = "Oct. 26, 12:52 a.m. EDT - The Full Hunter's Moon. With theleaves falling and the deer fattened, it is time to hunt. Since the fields have been reaped, hunters can ride over the stubble, and can moreeasily see the fox, also other animals that have come out to glean andcan be caught for a thanksgiving banquet after the harvest. The Moon will also be at perigee later this day, at 7:00 a.m., at a distance of 221,676 miles from Earth. Very high tides can be expected from the coincidence of perigee with full Moon.\n\nhttp://www.space.com/spacewatch/061229_moonnames2007.html";
$this
->assertFieldByName('body[und][0][value]', $body, 'Feed item 2 body correct.');
}