protected static $modules =
['system', 'user', 'condition_test', 'node'
];
/**
* Tests with both contexts mapped to the same user.
*/
public function testContextMissing() { /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
$condition = \Drupal::
service('plugin.manager.condition'
) ->
createInstance('condition_test_optional_context'
) ->
setContextMapping([ 'node' => 'node',
]);
\Drupal::
service('context.handler'
)->
applyContextMapping($condition,
[]);
$this->
assertTrue($condition->
execute());
} /**
* Tests with both contexts mapped to the same user.
*/
public function testContextNoValue() { /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */