protected function ConditionTestDualUserTest::doTestDifferentUser in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestDifferentUser()
Tests with each context mapped to different users.
1 call to ConditionTestDualUserTest::doTestDifferentUser()
- 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 76
Class
- ConditionTestDualUserTest
- Tests a condition that requires two users.
Namespace
Drupal\KernelTests\Core\Plugin\ConditionCode
protected function doTestDifferentUser() {
/** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
$condition = \Drupal::service('plugin.manager.condition')
->createInstance('condition_test_dual_user')
->setContextMapping([
'user1' => 'anonymous',
'user2' => 'authenticated',
]);
$contexts['anonymous'] = EntityContext::fromEntity($this->anonymous);
$contexts['authenticated'] = EntityContext::fromEntity($this->authenticated);
\Drupal::service('context.handler')
->applyContextMapping($condition, $contexts);
$this
->assertFalse($condition
->execute());
}