'will throw exception', NULL, TRUE, 'data_type'
],
];
} /**
* @covers ::getContextValue
* @dataProvider providerGetContextValue
*/
public function testGetContextValue($expected,
$context_value,
$is_required,
$data_type) { // Mock a Context object.
$mock_context =
$this->
getMockBuilder('Drupal\Component\Plugin\Context\Context'
) ->
disableOriginalConstructor() ->
onlyMethods(['getContextDefinition'
]) ->
getMock();
// If the context value exists, getContextValue() behaves like a normal
// getter.
if ($context_value) { // Set visibility of contextValue.
$ref_context_value =
new \
ReflectionProperty($mock_context, 'contextValue'
);
// Set contextValue to a testable state.
$ref_context_value->
setValue($mock_context,
$context_value);
// Exercise getContextValue().