function FieldLayoutTest::testNodeView

Same name in other branches
  1. 9 core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php \Drupal\Tests\field_layout\Functional\FieldLayoutTest::testNodeView()
  2. 8.9.x core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php \Drupal\Tests\field_layout\Functional\FieldLayoutTest::testNodeView()
  3. 11.x core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php \Drupal\Tests\field_layout\Functional\FieldLayoutTest::testNodeView()

Tests an entity type that has fields shown by default.

File

core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php, line 61

Class

FieldLayoutTest
Tests using field layout for entity displays.

Namespace

Drupal\Tests\field_layout\Functional

Code

public function testNodeView() : void {
    // By default, the one-column layout is used.
    $this->drupalGet('node/1');
    $this->assertSession()
        ->elementExists('css', '.layout--onecol');
    $this->assertSession()
        ->elementTextContains('css', '.layout__region--content', 'The node body');
    $this->drupalGet('admin/structure/types/manage/article/display');
    $this->assertEquals([
        'Content',
        'Disabled',
    ], $this->getRegionTitles());
    $this->assertSession()
        ->optionExists('fields[body][region]', 'content');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.