You are here

public function FeedsMapperLinkTestCase::testLinkFieldValidation in Feeds 7.2

Tests link field validation.

File

tests/feeds_mapper_link.test, line 330
Contains FeedsMapperLinkTestCase.

Class

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

Code

public function testLinkFieldValidation() {

  // Create and configure importer.
  $this
    ->createImporterConfiguration('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(
    'bundle' => $this->contentType,
  ));
  $this
    ->addMappings('csv', array(
    0 => array(
      'source' => 'title',
      'target' => 'title',
    ),
    1 => array(
      'source' => 'alpha',
      'target' => 'field_alpha:title',
    ),
    2 => array(
      'source' => 'alpha',
      'target' => 'field_alpha:url',
    ),
  ));
  $this
    ->importFile('csv', $this
    ->absolutePath() . '/tests/feeds/content.csv');
  $this
    ->assertText('Failed importing 1 node.');
  $this
    ->assertText("Field validation errors in item 'Ut wisi enim ad minim veniam'");
  $this
    ->assertText('The value Ut wisi provided for alpha_link_field_label is not a valid URL.');
}