function LocaleMultilingualFieldsFunctionalTest::testMultilingualDisplaySettings
7.x locale.test | LocaleMultilingualFieldsFunctionalTest::testMultilingualDisplaySettings() |
File
- drupal-7.x/
modules/ locale/ locale.test, line 2725 - Tests for locale.module.
Class
- LocaleMultilingualFieldsFunctionalTest
- Functional test for multilingual fields.
Code
function testMultilingualDisplaySettings() {
// Create "Basic page" content.
$langcode = LANGUAGE_NONE;
$title_key = "title";
$title_value = $this->randomName(8);
$body_key = "body[$langcode][0][value]";
$body_value = $this->randomName(16);
// Create node to edit.
$edit = array();
$edit[$title_key] = $title_value;
$edit[$body_key] = $body_value;
$edit['language'] = 'en';
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertTrue($node, 'Node found in database.');
// Check if node body is showed.
$this->drupalGet("node/$node->nid");
$body = $this->xpath('//div[@id=:id]//div[@property="content:encoded"]/p', array(':id' => 'node-' . $node->nid));
$this->assertEqual(current($body), $node->body['en'][0]['value'], 'Node body is correctly showed.');
}