\Drupal::
setContainer($container);
$this->plugin->
getPluginDefinition() ->
addContextDefinition('display', EntityContextDefinition::
fromEntityTypeId('entity_view_display'
)) ->
addContextDefinition('view_mode',
new ContextDefinition('string'
));
// Set an initial value on the section list.
$section_list =
$this->
prophesize(LayoutEntityDisplayInterface::
class);
$context =
$this->
prophesize(ContextInterface::
class);
$context->
getContextValue()->
willReturn($section_list->
reveal());
$this->plugin->
setContext('display',
$context->
reveal());
$section_list->
getThirdPartySetting('the_module', 'the_key', NULL
)->
willReturn('value 1'
);
// The plugin returns the initial value.
$this->
assertSame('value 1',
$this->plugin->
getThirdPartySetting('the_module', 'the_key'
));
// When the section list is updated, also update the result returned.
$section_list->
setThirdPartySetting('the_module', 'the_key', 'value 2'
)->
shouldBeCalled()->
will(function Darray
$args) use ($section_list) { $section_list->
getThirdPartySetting('the_module', 'the_key', NULL
)->
willReturn($args[2
]);
});