You are here

public function FieldLayoutTest::testRegionChanges in Drupal 9

Same name and namespace in other branches
  1. 8 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 73

Class

FieldLayoutTest
Tests using field layout for entity displays.

Namespace

Drupal\Tests\field_layout\Functional

Code

public function testRegionChanges() {
  $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');
}