Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / layout_builder / tests / src / Kernel / LayoutBuilderInstallTest.php
index fa646df1c91b10564a04df86110ec6e9fcd80d20..a3ae736da1c84e86b13fc0696eae7cb145d80624 100644 (file)
@@ -4,6 +4,7 @@ namespace Drupal\Tests\layout_builder\Kernel;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
 use Drupal\layout_builder\Section;
 
 /**
@@ -33,7 +34,9 @@ class LayoutBuilderInstallTest extends LayoutBuilderCompatibilityTestBase {
     $this->assertFieldAttributes($this->entity, $expected_fields);
 
     // Add a layout override.
-    $this->entity->get('layout_builder__layout')->appendSection(new Section('layout_onecol'));
+    $this->enableOverrides();
+    $this->entity = $this->reloadEntity($this->entity);
+    $this->entity->get(OverridesSectionStorage::FIELD_NAME)->appendSection(new Section('layout_onecol'));
     $this->entity->save();
 
     // The rendered entity has now changed. The non-configurable field is shown
@@ -48,7 +51,7 @@ class LayoutBuilderInstallTest extends LayoutBuilderCompatibilityTestBase {
     $this->assertNotEmpty($this->cssSelect('.layout--onecol'));
 
     // Removing the layout restores the original rendering of the entity.
-    $this->entity->get('layout_builder__layout')->removeSection(0);
+    $this->entity->get(OverridesSectionStorage::FIELD_NAME)->removeSection(0);
     $this->entity->save();
     $this->assertFieldAttributes($this->entity, $expected_fields);