You are here

public function ProcessorWebTest::testMappingByTitle in Feeds Comment Processor 7

Tests mapping to node by title.

File

src/Tests/ProcessorWebTest.php, line 163
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 testMappingByTitle() {
  $this
    ->removeMappings('comment', array(
    1 => array(
      'source' => 'guid',
      'target' => 'nid_by_guid',
    ),
  ));
  $this
    ->addMappings('comment', array(
    4 => array(
      'source' => 'title',
      'target' => 'nid_by_title',
    ),
  ));
  $url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds_comment_processor') . '/tests/test.csv';
  $nid = $this
    ->createFeedNode('comment', $url, 'Comment test');
  $this
    ->assertText('Created 1 comment');
  $comment = comment_load(1);
  $this
    ->assertEqual(1, $comment->nid);
  $this
    ->assertEqual('test subject', $comment->subject);
  $this
    ->assertEqual('example.com', $comment->hostname);
  $this
    ->assertEqual('test body text', $comment->comment_body[LANGUAGE_NONE][0]['value']);
  $this
    ->assertEqual('plain_text', $comment->comment_body[LANGUAGE_NONE][0]['format']);
}