function FieldLayoutTest::testRegionChanges

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

Tests that changes to the regions still leave the fields visible.

File

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

Class

FieldLayoutTest
Tests using field layout for entity displays.

Namespace

Drupal\Tests\field_layout\Functional

Code

public function testRegionChanges() : void {
    $this->drupalGet('admin/structure/types/manage/article/display');
    $this->assertEquals([
        'Content',
        'Disabled',
    ], $this->getRegionTitles());
    $this->assertSession()
        ->optionExists('fields[body][region]', 'content');
    \Drupal::state()->set('field_layout_test.alter_regions', TRUE);
    \Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
    $this->drupalGet('admin/structure/types/manage/article/display');
    $this->assertEquals([
        'Foo',
        'Disabled',
    ], $this->getRegionTitles());
    $this->assertSession()
        ->optionExists('fields[body][region]', 'hidden');
}

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