function ConditionTestDualUserTest::doTestDifferentUser
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestDifferentUser()
- 10 core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestDifferentUser()
- 11.x 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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.