You are here

public function DefaultsSectionStorageTest::testLoadFromDisplay in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testLoadFromDisplay()

Tests loading given a display.

File

core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php, line 208

Class

DefaultsSectionStorageTest
@coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testLoadFromDisplay() {
  $display = LayoutBuilderEntityViewDisplay::create([
    'targetEntityType' => 'entity_test',
    'bundle' => 'entity_test',
    'mode' => 'default',
    'status' => TRUE,
  ]);
  $display
    ->save();
  $contexts = [
    'display' => EntityContext::fromEntity($display),
  ];
  $section_storage_manager = $this->container
    ->get('plugin.manager.layout_builder.section_storage');
  $section_storage = $section_storage_manager
    ->load('defaults', $contexts);
  $this
    ->assertInstanceOf(DefaultsSectionStorage::class, $section_storage);
}