You are here

public function UpdateEntityDisplayTest::testExtraFieldsUpdate in Drupal 8

Tests that entity displays are updated to properly store extra fields.

See also

system_post_update_extra_fields()

File

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

Class

UpdateEntityDisplayTest
Tests updates for entity displays.

Namespace

Drupal\Tests\system\Functional\Update

Code

public function testExtraFieldsUpdate() {
  $assertion = function ($expected_keys) {
    $entity_view_display = EntityViewDisplay::load('node.article.default');
    $this
      ->assertEquals($expected_keys, array_keys($entity_view_display
      ->getComponent('links')));
  };

  // Before the update extra fields are missing additional configuration.
  $assertion([
    'weight',
    'region',
  ]);
  $this
    ->runUpdates();

  // After the update the additional configuration is present.
  $assertion([
    'weight',
    'region',
    'settings',
    'third_party_settings',
  ]);
}