You are here

public function ProcessorWebTest::setUp in Feeds Comment Processor 7

File

src/Tests/ProcessorWebTest.php, line 26
Contains \Drupal\feeds_comment_processor\Tests\ProcessorWebTest.

Class

ProcessorWebTest
Basic behavior tests for feeds_comment_processor.

Namespace

Drupal\feeds_comment_processor\Tests

Code

public function setUp() {
  parent::setUp('comment', 'feeds_comment_processor');

  // Create an importer configuration.
  $this
    ->createImporterConfiguration('Test', 'comment');

  // Set and configure plugins.
  $this
    ->setPlugin('comment', 'FeedsCSVParser');
  $this
    ->setPlugin('comment', 'FeedsCommentProcessor');
  $edit = array(
    'bundle' => 'comment_node_article',
  );
  $this
    ->setSettings('comment', 'FeedsCommentProcessor', $edit);
  $this
    ->addMappings('comment', array(
    0 => array(
      'source' => 'subject',
      'target' => 'subject',
    ),
    1 => array(
      'source' => 'guid',
      'target' => 'nid_by_guid',
    ),
    2 => array(
      'source' => 'body',
      'target' => 'comment_body',
      'format' => 'plain_text',
    ),
    3 => array(
      'source' => 'status',
      'target' => 'status',
    ),
    4 => array(
      'source' => 'hostname',
      'target' => 'hostname',
    ),
  ));
  $parent = (object) array(
    'title' => 'Parent',
    'type' => 'article',
  );
  node_save($parent);

  // Insert a feeds_item record.
  $item = (object) array(
    'guid' => 10,
    'url' => '',
    'entity_type' => 'node',
    'entity_id' => $parent->nid,
    'feed_nid' => 0,
    'id' => 'node_importer',
  );
  drupal_write_record('feeds_item', $item);
}