You are here

public function DefaultsSectionStorageTest::testLoadFromDisplay in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testLoadFromDisplay()
  2. 10 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 223

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);
}