You are here

public function LayoutBuilderContextMappingUpdatePathTest::testRunUpdates in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderContextMappingUpdatePathTest.php \Drupal\Tests\layout_builder\Functional\Update\LayoutBuilderContextMappingUpdatePathTest::testRunUpdates()

Tests the upgrade path for Layout Builder layout context mappings.

File

core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderContextMappingUpdatePathTest.php, line 31

Class

LayoutBuilderContextMappingUpdatePathTest
Tests the upgrade path for Layout Builder layout context mappings.

Namespace

Drupal\Tests\layout_builder\Functional\Update

Code

public function testRunUpdates() {
  $data = EntityViewDisplay::load('node.article.teaser')
    ->toArray();
  $this
    ->assertSame(TRUE, $data['third_party_settings']['layout_builder']['enabled']);
  $this
    ->assertArrayNotHasKey('context_mapping', $data['third_party_settings']['layout_builder']['sections'][0]
    ->toArray()['layout_settings']);
  $this
    ->runUpdates();
  $data = EntityViewDisplay::load('node.article.teaser')
    ->toArray();
  $this
    ->assertSame(TRUE, $data['third_party_settings']['layout_builder']['enabled']);
  $this
    ->assertSame([], $data['third_party_settings']['layout_builder']['sections'][0]
    ->toArray()['layout_settings']['context_mapping']);
}