function DefaultsSectionStorageTest::testLoadFromDisplay

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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);
}

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