function ConditionTestDualUserTest::doTestIdenticalUser
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestIdenticalUser()
- 10 core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestIdenticalUser()
- 11.x core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestIdenticalUser()
Tests with both contexts mapped to the same user.
1 call to ConditionTestDualUserTest::doTestIdenticalUser()
- ConditionTestDualUserTest::testConditions in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Condition/ ConditionTestDualUserTest.php - Tests the dual user condition.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Condition/ ConditionTestDualUserTest.php, line 59
Class
- ConditionTestDualUserTest
- Tests a condition that requires two users.
Namespace
Drupal\KernelTests\Core\Plugin\ConditionCode
protected function doTestIdenticalUser() {
/** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
$condition = \Drupal::service('plugin.manager.condition')->createInstance('condition_test_dual_user')
->setContextMapping([
'user1' => 'anonymous',
'user2' => 'anonymous',
]);
$contexts['anonymous'] = EntityContext::fromEntity($this->anonymous);
\Drupal::service('context.handler')->applyContextMapping($condition, $contexts);
$this->assertTrue($condition->execute());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.