You are here

public function EntityTranslationContentTranslationTestCase::testCopyFieldsUsingContentTranslation in Entity Translation 7

Tests copying of source node's body value in the add translation form page.

File

tests/entity_translation.test, line 741
Tests for Entity translation module.

Class

EntityTranslationContentTranslationTestCase
Basic tests for nodes using both content and entity translation.

Code

public function testCopyFieldsUsingContentTranslation() {

  // Create Basic page in English.
  $node_title = $this
    ->randomName();
  $node_body = $this
    ->randomName();
  $node = $this
    ->createPage($node_title, $node_body, 'en');

  // Check that the edit form correctly copies over the field's values from
  // the source node.
  $target_language = 'es';
  $this
    ->drupalGet('node/add/page', array(
    'query' => array(
      'translation' => $node->nid,
      'target' => $target_language,
    ),
  ));
  $body_key = "body[{$target_language}][0][value]";
  $this
    ->assertFieldByXPath("//textarea[@name='{$body_key}']", $node_body, "Body field correctly instantiated with the value of the source language.");
}