function NodeFieldMultilingualTest::testMultilingualDisplaySettings
Same name in other branches
- 8.9.x core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php \Drupal\Tests\node\Functional\NodeFieldMultilingualTest::testMultilingualDisplaySettings()
- 10 core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php \Drupal\Tests\node\Functional\NodeFieldMultilingualTest::testMultilingualDisplaySettings()
- 11.x core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php \Drupal\Tests\node\Functional\NodeFieldMultilingualTest::testMultilingualDisplaySettings()
Tests multilingual field display settings.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeFieldMultilingualTest.php, line 126
Class
- NodeFieldMultilingualTest
- Tests multilingual support for fields.
Namespace
Drupal\Tests\node\FunctionalCode
public 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 = [];
$edit[$title_key] = $title_value;
$edit[$body_key] = $body_value;
$this->drupalGet('node/add/page');
$this->submitForm($edit, 'Save');
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertNotEmpty($node, 'Node found in database.');
// Check if node body is showed.
$this->drupalGet('node/' . $node->id());
$this->assertSession()
->elementTextEquals('xpath', "//article/div//p", $node->body->value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.