You are here

protected function ConditionTestDualUserTest::doTestIdenticalUser in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php \Drupal\KernelTests\Core\Plugin\Condition\ConditionTestDualUserTest::doTestIdenticalUser()
  2. 10 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\Condition

Code

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());
}