You are here

public function FeedsTamperWebTestCase::testBasic in Feeds Tamper 6

Same name and namespace in other branches
  1. 7 tests/feeds_tamper.test \FeedsTamperWebTestCase::testBasic()

File

tests/feeds_tamper.test, line 145
Tests for feeds_tamper.module.

Class

FeedsTamperWebTestCase
Simple tests for api functionality.

Code

public function testBasic() {
  $this
    ->createImporterConfiguration();
  $this
    ->addMappings('syndication', array(
    array(
      'source' => 'title',
      'target' => 'title',
    ),
    array(
      'source' => 'guid',
      'target' => 'guid',
      'unique' => TRUE,
    ),
    array(
      'source' => 'description',
      'target' => 'body',
    ),
  ));

  // Set update existing.
  $this
    ->setSettings('syndication', 'FeedsNodeProcessor', array(
    'update_existing' => 1,
  ));

  // Test basic plugin adding.
  $settings = array(
    'mode' => 0,
  );
  $id = $this
    ->addTamperPlugin('syndication', 'title', 'convert_case', $settings);

  // Create feed node, running import automatically.
  $nid = $this
    ->createFeedNode();

  // Assert that all titles were uppercased.
  $this
    ->assertUppercaseDevseedFeedContent();

  // Disable plugin.
  $this
    ->disableTamperPlugin($id);

  //$this->deleteTamperPlugin($id);
  $this
    ->drupalPost('node/' . $nid . '/import', array(), 'Import');
  $this
    ->assertText('Updated 10 Story nodes.');
  $this
    ->assertDevseedFeedContent();
}