function FieldLayoutTest::testNodeView

Same name and namespace in other branches
  1. 9 core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php \Drupal\Tests\field_layout\Functional\FieldLayoutTest::testNodeView()
  2. 10 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 59

Class

FieldLayoutTest
Tests using field layout for entity displays.

Namespace

Drupal\Tests\field_layout\Functional

Code

public function testNodeView() {
    // By default, the one-column layout is used.
    $this->drupalGet('node/1');
    $this->assertSession()
        ->elementExists('css', '.layout--onecol');
    $this->assertSession()
        ->elementExists('css', '.layout__region--content .field--name-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.