public function FeedsMapperLinkTest::test in Feeds 8.2
Basic test loading a single entry CSV file.
File
- lib/
Drupal/ feeds/ Tests/ FeedsMapperLinkTest.php, line 39 - Test case for CCK link mapper mappers/date.inc.
Class
- FeedsMapperLinkTest
- Class for testing Feeds <em>link</em> mapper.
Namespace
Drupal\feeds\TestsCode
public function test() {
// $static_title = $this->randomName();
// Create content type.
$typename = $this
->createContentType(array(), array(
'alpha' => array(
'type' => 'link',
'instance_settings' => array(
'instance[settings][title]' => 2,
),
),
'beta' => array(
'type' => 'link',
'instance_settings' => array(
'instance[settings][title]' => 0,
),
),
'gamma' => array(
'type' => 'link',
'instance_settings' => array(
'instance[settings][title]' => 1,
),
),
));
// Create importer configuration.
$this
->createImporterConfiguration();
$this
->setSettings('syndication', 'node', array(
'bundle' => $typename,
));
$this
->addMappings('syndication', array(
0 => array(
'source' => 'title',
'target' => 'title',
),
1 => array(
'source' => 'timestamp',
'target' => 'created',
),
2 => array(
'source' => 'description',
'target' => 'body',
),
3 => array(
'source' => 'url',
'target' => 'field_alpha:url',
),
4 => array(
'source' => 'title',
'target' => 'field_alpha:title',
),
5 => array(
'source' => 'url',
'target' => 'field_beta:url',
),
6 => array(
'source' => 'url',
'target' => 'field_gamma:url',
),
7 => array(
'source' => 'title',
'target' => 'field_gamma:title',
),
));
// Import RSS file.
$nid = $this
->createFeedNode();
// Assert 10 items aggregated after creation of the node.
$this
->assertText('Created 10 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
->assertNodeFieldValue('alpha', array(
'url' => $url,
'static' => $title,
));
$this
->assertNodeFieldValue('beta', array(
'url' => $url,
));
$this
->assertNodeFieldValue('gamma', array(
'url' => $url,
'static' => $title,
));
// $this->assertNodeFieldValue('omega', array('url' => $url, 'static' => $static_title));
// Test the static title.
// $this->drupalGet('node/2');
// $this->assertText($static_title, 'Static title link found.');
}