1 locale.test LocaleMultilingualFieldsFunctionalTest::testMultilingualDisplaySettings()

File

core/modules/locale/tests/locale.test, line 2571
Tests for locale.module.

Class

LocaleMultilingualFieldsFunctionalTest
Functional test for multilingual fields.

Code

function testMultilingualDisplaySettings() {
  // Create "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['langcode'] = 'en';
  $this->backdropPost('node/add/page', $edit, t('Save'));

  // Check that the node exists in the database.
  $node = $this->backdropGetNodeByTitle($edit[$title_key]);
  $this->assertTrue($node, 'Node found in database.');

  // Check if node body is shown.
  $this->backdropGet("node/$node->nid");
  $body = $this->xpath('//article[@id=:id]//p', array(':id' => 'node-' . $node->nid));
  $this->assertEqual(current($body), $node->body['en'][0]['value'], 'Node body is correctly shown.');
}