$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
]);
});
// Update the plugin value.
$this->plugin->
setThirdPartySetting('the_module', 'the_key', 'value 2'
);
// Assert that the returned value matches.
$this->
assertSame('value 2',
$this->plugin->
getThirdPartySetting('the_module', 'the_key'
));
} /**
* @covers ::extractEntityFromRoute
*
* @dataProvider providerTestExtractEntityFromRoute
*
* @param bool $success
* Whether a successful result is expected.
* @param string|null $expected_entity_id
* The expected entity ID.
* @param string $value
* The value to pass to ::extractEntityFromRoute().
* @param array $defaults
* The defaults to pass to ::extractEntityFromRoute().
*/