public function FeedsMapperLinkTestCase::test in Feeds 6
Same name and namespace in other branches
- 7.2 tests/feeds_mapper_link.test \FeedsMapperLinkTestCase::test()
- 7 tests/feeds_mapper_link.test \FeedsMapperLinkTestCase::test()
Basic test loading a single entry CSV file.
File
- tests/
feeds_mapper_link.test, line 29 - Test case for CCK link mapper mappers/date.inc.
Class
- FeedsMapperLinkTestCase
- Class for testing Feeds <em>link</em> mapper.
Code
public function test() {
$static_title = $this
->randomName();
// Create content type.
$typename = $this
->createContentType(array(), array(
'alpha' => array(
'type' => 'link',
'settings' => array(
'title' => 'required',
'multiple' => '0',
),
),
'beta' => array(
'type' => 'link',
'settings' => array(
'title' => 'none',
'multiple' => '0',
),
),
'gamma' => array(
'type' => 'link',
'settings' => array(
'title' => 'optional',
'multiple' => '0',
),
),
'omega' => array(
'type' => 'link',
'settings' => array(
'title' => 'value',
'title_value' => $static_title,
'multiple' => '0',
),
),
));
// Create importer configuration.
$this
->createImporterConfiguration();
//Create a default importer configuration
$this
->setSettings('syndication', 'FeedsNodeProcessor', array(
'content_type' => $typename,
));
//Processor settings
$this
->addMappings('syndication', array(
array(
'source' => 'title',
'target' => 'title',
),
array(
'source' => 'timestamp',
'target' => 'created',
),
array(
'source' => 'description',
'target' => 'body',
),
array(
'source' => 'url',
'target' => 'field_alpha:url',
),
array(
'source' => 'title',
'target' => 'field_alpha:title',
),
array(
'source' => 'url',
'target' => 'field_beta:url',
),
array(
'source' => 'url',
'target' => 'field_gamma:url',
),
array(
'source' => 'title',
'target' => 'field_gamma:title',
),
array(
'source' => 'url',
'target' => 'field_omega:url',
),
));
// Import RSS file.
$nid = $this
->createFeedNode();
// Assert 10 items aggregated after creation of the node.
$this
->assertText('Created 10 ' . $typename . ' nodes.');
// Edit the imported node.
$this
->drupalGet('node/2/edit');
$url = 'http://developmentseed.org/blog/2009/oct/06/open-atrium-translation-workflow-two-way-updating';
$title = 'Open Atrium Translation Workflow: Two Way Translation Updates';
$this
->assertCCKFieldValue('alpha', array(
'url' => $url,
'static' => $title,
));
$this
->assertCCKFieldValue('beta', array(
'url' => $url,
));
$this
->assertCCKFieldValue('gamma', array(
'url' => $url,
'static' => $title,
));
$this
->assertCCKFieldValue('omega', array(
'url' => $url,
'static' => $static_title,
));
// Test the static title.
$this
->drupalGet('node/2');
$this
->assertText($static_title, 'Static title link found.');
}