function FeedsMapperEmailTestCase::test in Feeds 6
Basic test loading a doulbe entry CSV file.
File
- tests/
feeds_mapper_email.test, line 29 - Test case for simple CCK field mapper mappers/email.inc.
Class
- FeedsMapperEmailTestCase
- Class for testing Feeds <em>email</em> mapper.
Code
function test() {
// Create content type.
$typename = $this
->createContentType(array(), array(
'email' => 'email',
));
// Create and configure importer.
$this
->createImporterConfiguration('Email CSV', 'csv');
$this
->setSettings('csv', NULL, array(
'content_type' => '',
'import_period' => FEEDS_SCHEDULE_NEVER,
));
$this
->setPlugin('csv', 'FeedsFileFetcher');
$this
->setPlugin('csv', 'FeedsCSVParser');
$this
->setSettings('csv', 'FeedsNodeProcessor', array(
'content_type' => $typename,
));
$this
->addMappings('csv', array(
array(
'source' => 'title',
'target' => 'title',
),
array(
'source' => 'created',
'target' => 'created',
),
array(
'source' => 'body',
'target' => 'body',
),
array(
'source' => 'email',
'target' => 'field_email',
),
));
// Import CSV file.
$this
->importFile('csv', $this
->absolutePath() . '/tests/feeds/email.csv');
$this
->assertText('Created 2 ' . $typename . ' nodes.');
// Check the two imported files.
$this
->drupalGet('node/1/edit');
$this
->assertCCKFieldValue('email', 'user1@example.org');
$this
->drupalGet('node/2/edit');
$this
->assertCCKFieldValue('email', 'user2@example.org');
}