LayoutBuilderContextMappingUpdatePathTest.php in Drupal 9
File
core/modules/layout_builder/tests/src/Functional/Update/LayoutBuilderContextMappingUpdatePathTest.php
View source
<?php
namespace Drupal\Tests\layout_builder\Functional\Update;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class LayoutBuilderContextMappingUpdatePathTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.0.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/layout-builder.php',
__DIR__ . '/../../../fixtures/update/layout-builder-context-mapping.php',
];
}
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']);
}
}