public function DefaultsSectionStorageTest::testGetContexts in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testGetContexts()
- 9 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testGetContexts()
@covers ::getContexts
File
- core/
modules/ layout_builder/ tests/ src/ Kernel/ DefaultsSectionStorageTest.php, line 139
Class
- DefaultsSectionStorageTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage
Namespace
Drupal\Tests\layout_builder\KernelCode
public function testGetContexts() {
$display = LayoutBuilderEntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
'status' => TRUE,
]);
$display
->save();
$context = EntityContext::fromEntity($display);
$this->plugin
->setContext('display', $context);
$result = $this->plugin
->getContexts();
$this
->assertSame([
'view_mode',
'display',
], array_keys($result));
$this
->assertSame($context, $result['display']);
}