You are here

public function FeedsTamperWebTestCase::testCopyPlugin in Feeds Tamper 7

Integration tests for the copy plugin.

File

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

Class

FeedsTamperWebTestCase
Simple tests for api functionality.

Code

public function testCopyPlugin() {
  $this
    ->removeMappings('syndication', array(
    2 => array(
      'source' => 'description',
      'target' => 'body',
    ),
  ));
  $this
    ->addMappings('syndication', array(
    2 => array(
      'source' => 'Blank source 1',
      'target' => 'body',
    ),
  ));

  // Test copy to.
  // The case should get converted for the title, but not the body.
  $copy = $this
    ->addTamperPlugin('syndication', 'title', 'copy', array(
    'to_from' => 'to',
    'source' => 'Blank source 1',
  ));
  $convert_case = $this
    ->addTamperPlugin('syndication', 'title', 'convert_case', array(
    'mode' => 0,
  ));

  // Create feed node, running import automatically.
  $nid = $this
    ->createFeedNode();
  $this
    ->drupalGet('node/2/edit');
  $this
    ->assertFieldByXPath("//textarea[@name='body[und][0][value]']", 'Open Atrium Translation Workflow: Two Way Translation Updates', 'The textfield widget is populated.');
  $this
    ->assertFieldByName('title', 'OPEN ATRIUM TRANSLATION WORKFLOW: TWO WAY TRANSLATION UPDATES');
  $this
    ->disableTamperPlugin($convert_case);
  $this
    ->addTamperPlugin('syndication', 'Blank source 1', 'convert_case', array(
    'mode' => 0,
  ));
  $this
    ->drupalPost('node/' . $nid . '/import', array(), 'Import');
  $this
    ->drupalGet('node/2/edit');
  $this
    ->assertFieldByXPath("//textarea[@name='body[und][0][value]']", 'OPEN ATRIUM TRANSLATION WORKFLOW: TWO WAY TRANSLATION UPDATES', 'The textfield widget is populated.');
  $this
    ->assertFieldByName('title', 'Open Atrium Translation Workflow: Two Way Translation Updates');
}