You are here

public function FeedsEntityProcessorDateTest::setUp in Feeds entity processor 7

Set up test.

File

tests/src/FeedsEntityProcessorDateTest.test, line 42
Contains FeedsEntityProcessorDateTest.

Class

FeedsEntityProcessorDateTest
Tests importing entities with properties of various data types.

Code

public function setUp() {
  parent::setUp(array(
    'feeds_entity_processor',
    'feeds_entity_processor_test',
    'date_api',
  ));

  // Create an importer configuration.
  $this
    ->createImporterConfiguration('Syndication', 'syndication');
  $this
    ->setPlugin('syndication', 'FeedsCSVParser');
  $this
    ->setPlugin('syndication', 'FeedsEntityProcessorFeeds_entity_processor_test');

  // Create bundle entity.
  $this->bundle = drupal_strtolower($this
    ->randomName());
  entity_create('feeds_entity_processor_test_type', array(
    'id' => drupal_strtolower($this
      ->randomName()),
    'name' => $this->bundle,
  ))
    ->save();

  // Create a node.
  $this->node = $this
    ->drupalCreateNode();

  // Set bundle and set default values for required properties.
  $this
    ->setSettings('syndication', 'FeedsEntityProcessorFeeds_entity_processor_test', array(
    'bundle' => $this->bundle,
    'values[entity][entity_type]' => 'node',
    'values[entity][entity_id]' => $this->node->nid,
    'values[user]' => 1,
  ));
  $this
    ->addMappings('syndication', array(
    0 => array(
      'source' => 'guid',
      'target' => 'guid',
      'unique' => TRUE,
    ),
    1 => array(
      'source' => 'title',
      'target' => 'title',
    ),
  ));
}