You are here

public function FeedsMapperLinkTestCase::test in Feeds 7.2

Same name and namespace in other branches
  1. 6 tests/feeds_mapper_link.test \FeedsMapperLinkTestCase::test()
  2. 7 tests/feeds_mapper_link.test \FeedsMapperLinkTestCase::test()

Basic test loading a single entry CSV file.

File

tests/feeds_mapper_link.test, line 80
Contains FeedsMapperLinkTestCase.

Class

FeedsMapperLinkTestCase
Test case for CCK link mapper mappers/date.inc.

Code

public function test() {

  // Create importer configuration.
  // Create a default importer configuration.
  $this
    ->createImporterConfiguration();

  // Processor settings.
  $this
    ->setSettings('syndication', 'FeedsNodeProcessor', array(
    'bundle' => $this->contentType,
  ));
  $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',
    ),
    8 => 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 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' => $this->staticTitle,
  ));

  // Test the static title.
  $this
    ->drupalGet('node/2');
  $this
    ->assertText($this->staticTitle, 'Static title link found.');
}