
| Current Path : /var/www/html/pallets_old/web/core/modules/node/tests/src/Functional/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/pallets_old/web/core/modules/node/tests/src/Functional/NodeViewLanguageTest.php |
<?php
namespace Drupal\Tests\node\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
/**
* Tests the node language extra field display.
*
* @group node
*/
class NodeViewLanguageTest extends NodeTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['node', 'datetime', 'language'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the language extra field display.
*/
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');
}
}