return $data;
} /**
* @covers ::getSectionStorageForEntity
*
* @dataProvider providerTestGetSectionStorageForEntity
*/
public function testGetSectionStorageForEntity($entity_type_id,
$values,
$expected_context_keys) { $section_storage_manager =
$this->
prophesize(SectionStorageManagerInterface::
class);
$section_storage_manager->
load(''
)->
willReturn(NULL
);
$section_storage_manager->
findByContext(Argument::
cetera())->
will(function D
$arguments) { return $arguments[0
];
});
$this->container->
set('plugin.manager.layout_builder.section_storage',
$section_storage_manager->
reveal());
$entity =
$this->container->
get('entity_type.manager'
)->
getStorage($entity_type_id)->
create($values);
$entity->
save();
$class =
new TestLayoutEntityHelperTrait();
$result =
$class->
getSectionStorageForEntity($entity);
$this->
assertEquals($expected_context_keys,
array_keys($result));
if ($entity instanceof EntityViewDisplayInterface
) { $this->
assertEquals(EntityContext::
fromEntity($entity),
$result['display'
]);
}