function TextTranslationTestCase::testTextField
7.x text.test | TextTranslationTestCase::testTextField() |
Test that a plaintext textfield widget is correctly populated.
File
- drupal-7.x/
modules/ field/ modules/ text/ text.test, line 445 - Tests for text.module.
Class
Code
function testTextField() {
// Disable text processing for body.
$edit = array('instance[settings][text_processing]' => 0);
$this->drupalPost('admin/structure/types/manage/article/fields/body', $edit, t('Save settings'));
// Login as translator.
$this->drupalLogin($this->translator);
// Create content.
$langcode = LANGUAGE_NONE;
$body = $this->randomName();
$edit = array(
"title" => $this->randomName(),
"language" => 'en',
"body[$langcode][0][value]" => $body,
);
// Translate the article in french.
$this->drupalPost('node/add/article', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->drupalGet("node/$node->nid/translate");
$this->clickLink(t('add translation'));
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.');
}