function LayoutBuilderContextMappingUpdatePathTest::testRunUpdates

Same name in other branches
  1. 8.9.x 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']);
}

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