public function OverridesSectionStorageTest::testGetContextsDuringPreview in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testGetContextsDuringPreview()
- 10 core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testGetContextsDuringPreview()
@covers ::getContextsDuringPreview
File
- core/
modules/ layout_builder/ tests/ src/ Kernel/ OverridesSectionStorageTest.php, line 195
Class
- OverridesSectionStorageTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage
Namespace
Drupal\Tests\layout_builder\KernelCode
public function testGetContextsDuringPreview() {
$entity = EntityTest::create();
$entity
->save();
$context = EntityContext::fromEntity($entity);
$this->plugin
->setContext('entity', $context);
$expected = [
'view_mode',
'layout_builder.entity',
];
$result = $this->plugin
->getContextsDuringPreview();
$this
->assertEquals($expected, array_keys($result));
$this
->assertSame($context, $result['layout_builder.entity']);
}