You are here

public function NodeViewLanguageTest::testViewLanguage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeViewLanguageTest.php \Drupal\node\Tests\NodeViewLanguageTest::testViewLanguage()

Tests the language extra field display.

File

core/modules/node/src/Tests/NodeViewLanguageTest.php, line 29
Contains \Drupal\node\Tests\NodeViewLanguageTest.

Class

NodeViewLanguageTest
Tests the node language extra field display.

Namespace

Drupal\node\Tests

Code

public function testViewLanguage() {

  // Add Spanish language.
  ConfigurableLanguage::createFromLangcode('es')
    ->save();

  // Set language field visible.
  entity_get_display('node', 'page', 'full')
    ->setComponent('langcode')
    ->save();

  // Create a node in Spanish.
  $node = $this
    ->drupalCreateNode(array(
    'langcode' => 'es',
  ));
  $this
    ->drupalGet($node
    ->urlInfo());
  $this
    ->assertText('Spanish', 'The language field is displayed properly.');
}