public function OverridesSectionStorageTest::testDeriveContextsFromRoute in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testDeriveContextsFromRoute()
@covers ::deriveContextsFromRoute
File
- core/
modules/ layout_builder/ tests/ src/ Kernel/ OverridesSectionStorageTest.php, line 236
Class
- OverridesSectionStorageTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage
Namespace
Drupal\Tests\layout_builder\KernelCode
public function testDeriveContextsFromRoute() {
$display = LayoutBuilderEntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
'status' => TRUE,
]);
$display
->enableLayoutBuilder()
->setOverridable()
->save();
$entity = EntityTest::create();
$entity
->save();
$entity = EntityTest::load($entity
->id());
$result = $this->plugin
->deriveContextsFromRoute('entity_test.1', [], '', []);
$this
->assertSame([
'entity',
'view_mode',
], array_keys($result));
$this
->assertSame($entity, $result['entity']
->getContextValue());
$this
->assertSame('default', $result['view_mode']
->getContextValue());
}