1 text.test TextTranslationTestCase::testTextField()

Test that a plaintext textfield widget is correctly populated.

File

core/modules/field/modules/text/tests/text.test, line 594
Tests for text.module.

Class

TextTranslationTestCase

Code

function testTextField() {
  // Disable text processing for body.
  $edit = array('instance[settings][text_processing]' => 0);
  $this->backdropPost('admin/structure/types/manage/post/fields/body', $edit, t('Save settings'));

  // Login as translator.
  $this->backdropLogin($this->translator);

  // Create content.
  $langcode = LANGUAGE_NONE;
  $body = $this->randomName();
  $edit = array(
    'title' => $this->randomName(),
    'langcode' => 'en',
    "body[$langcode][0][value]" => $body,
  );

  // Translate the post in French.
  $this->backdropPost('node/add/post', $edit, t('Save'));
  $node = $this->backdropGetNodeByTitle($edit['title']);
  $this->backdropGet("node/$node->nid/translate");
  $this->clickLink(t('Add translation'));
  $this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.');
}