function UpdateEntityDisplayTest::testRegionUpdate

Tests that entity displays are updated with regions for their fields.

See also

system_post_update_add_region_to_entity_displays()

File

core/modules/system/tests/src/Functional/Update/UpdateEntityDisplayTest.php, line 36

Class

UpdateEntityDisplayTest
Tests updates for entity displays.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function testRegionUpdate() {
    // No region key appears pre-update.
    $entity_form_display = EntityFormDisplay::load('node.article.default');
    $options = $entity_form_display->getComponent('body');
    $this->assertFalse(array_key_exists('region', $options));
    $entity_view_display = EntityViewDisplay::load('node.article.default');
    $options = $entity_view_display->getComponent('body');
    $this->assertFalse(array_key_exists('region', $options));
    $this->runUpdates();
    // The region key has been populated with 'content'.
    $entity_form_display = EntityFormDisplay::load('node.article.default');
    $options = $entity_form_display->getComponent('body');
    $this->assertIdentical('content', $options['region']);
    $entity_view_display = EntityViewDisplay::load('node.article.default');
    $options = $entity_view_display->getComponent('body');
    $this->assertIdentical('content', $options['region']);
}

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