public function NodeFieldMultilingualTest::testMultilingualDisplaySettings in Drupal 9
Same name and namespace in other branches
- 8 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()
Tests multilingual field display settings.
File
- core/
modules/ node/ tests/ src/ Functional/ NodeFieldMultilingualTest.php, line 123
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[contains(concat(' ', normalize-space(@class), ' '), ' node ')]//div[contains(concat(' ', normalize-space(@class), ' '), 'node__content')]/descendant::p", $node->body->value);
}