function NodeFieldMultilingualTest::testMultilingualDisplaySettings in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/src/Tests/NodeFieldMultilingualTest.php \Drupal\node\Tests\NodeFieldMultilingualTest::testMultilingualDisplaySettings()
File
- core/
modules/ node/ src/ Tests/ NodeFieldMultilingualTest.php, line 108 - Contains \Drupal\node\Tests\NodeFieldMultilingualTest.
Class
- NodeFieldMultilingualTest
- Tests multilingual support for fields.
Namespace
Drupal\node\TestsCode
function testMultilingualDisplaySettings() {
// Create "Basic page" content.
$title_key = 'title[0][value]';
$title_value = $this
->randomMachineName(8);
$body_key = 'body[0][value]';
$body_value = $this
->randomMachineName(16);
// Create node to edit.
$edit = array();
$edit[$title_key] = $title_value;
$edit[$body_key] = $body_value;
$this
->drupalPostForm('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
->id());
$body = $this
->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]//div[contains(concat(" ", normalize-space(@class), " "), :content-class)]/descendant::p', array(
':node-class' => ' node ',
':content-class' => 'node__content',
));
$this
->assertEqual(current($body), $node->body->value, 'Node body found.');
}