function NodeViewLanguageTest::testViewLanguage
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeViewLanguageTest.php \Drupal\Tests\node\Functional\NodeViewLanguageTest::testViewLanguage()
- 8.9.x core/modules/node/tests/src/Functional/NodeViewLanguageTest.php \Drupal\Tests\node\Functional\NodeViewLanguageTest::testViewLanguage()
- 10 core/modules/node/tests/src/Functional/NodeViewLanguageTest.php \Drupal\Tests\node\Functional\NodeViewLanguageTest::testViewLanguage()
Tests the language extra field display.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeViewLanguageTest.php, line 29
Class
- NodeViewLanguageTest
- Tests the node language extra field display.
Namespace
Drupal\Tests\node\FunctionalCode
public function testViewLanguage() : void {
// Add Spanish language.
ConfigurableLanguage::createFromLangcode('es')->save();
// Set language field visible.
\Drupal::service('entity_display.repository')->getViewDisplay('node', 'page', 'full')
->setComponent('langcode')
->save();
// Create a node in Spanish.
$node = $this->drupalCreateNode([
'langcode' => 'es',
]);
$this->drupalGet($node->toUrl());
$this->assertSession()
->pageTextContains('Spanish');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.