function DefaultsSectionStorageTest::testGetSectionListFromIdCreate
@covers ::getSectionListFromId
@expectedDeprecation \Drupal\layout_builder\SectionStorageInterface::getSectionListFromId() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. The section list should be derived from context. See https://www.drupal.org/node/3016262.
@group legacy
File
-
core/
modules/ layout_builder/ tests/ src/ Unit/ DefaultsSectionStorageTest.php, line 216
Class
- DefaultsSectionStorageTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage
Namespace
Drupal\Tests\layout_builder\UnitCode
public function testGetSectionListFromIdCreate() {
$expected = 'the_return_value';
$value = 'foo.bar.baz';
$expected_create_values = [
'targetEntityType' => 'foo',
'bundle' => 'bar',
'mode' => 'baz',
'status' => TRUE,
];
$entity_storage = $this->prophesize(EntityStorageInterface::class);
$entity_storage->load($value)
->willReturn(NULL);
$entity_storage->create($expected_create_values)
->willReturn($expected);
$this->entityTypeManager
->getDefinition('entity_view_display')
->willReturn(new EntityType([
'id' => 'entity_view_display',
]));
$this->entityTypeManager
->getStorage('entity_view_display')
->willReturn($entity_storage->reveal());
$result = $this->plugin
->getSectionListFromId($value);
$this->assertSame($expected, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.