public function NodeViewLanguageTest::testViewLanguage in Drupal 9
Same name and namespace in other branches
- 8 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() {
// 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');
}