function DefaultsSectionStorageTest::testLoadFromDisplay

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

Class

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

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testLoadFromDisplay() : void {
    $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);
}

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