function OptionalContextConditionTest::testContextMissing
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php \Drupal\KernelTests\Core\Plugin\Condition\OptionalContextConditionTest::testContextMissing()
- 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php \Drupal\KernelTests\Core\Plugin\Condition\OptionalContextConditionTest::testContextMissing()
- 10 core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php \Drupal\KernelTests\Core\Plugin\Condition\OptionalContextConditionTest::testContextMissing()
Tests with both contexts mapped to the same user.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Condition/ OptionalContextConditionTest.php, line 29
Class
- OptionalContextConditionTest
- Tests a condition with optional context.
Namespace
Drupal\KernelTests\Core\Plugin\ConditionCode
public function testContextMissing() : void {
/** @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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.