You are here

protected function ProtectionRuleBypassTest::doUserProtectionBypassTest in User protect 8

Tests if bypassing a certain user protection is respected.

Parameters

string $plugin: The name of the UserProtection plugin.

string $operation: The access operation to check.

5 calls to ProtectionRuleBypassTest::doUserProtectionBypassTest()
ProtectionRuleBypassTest::testUserDeleteProtectionBypass in tests/src/Kernel/ProtectionRuleBypassTest.php
Tests if bypassing user delete protection is respected.
ProtectionRuleBypassTest::testUserEditProtectionBypass in tests/src/Kernel/ProtectionRuleBypassTest.php
Tests if bypassing user edit protection is respected.
ProtectionRuleBypassTest::testUserMailEditProtectionBypass in tests/src/Kernel/ProtectionRuleBypassTest.php
Tests if bypassing user mail edit protection is respected.
ProtectionRuleBypassTest::testUserNameEditProtectionBypass in tests/src/Kernel/ProtectionRuleBypassTest.php
Tests if bypassing user name edit protection is respected.
ProtectionRuleBypassTest::testUserPassEditProtectionBypass in tests/src/Kernel/ProtectionRuleBypassTest.php
Tests if bypassing user password edit protection is respected.

File

tests/src/Kernel/ProtectionRuleBypassTest.php, line 130

Class

ProtectionRuleBypassTest
Tests bypassing protection rules.

Namespace

Drupal\Tests\userprotect\Kernel

Code

protected function doUserProtectionBypassTest($plugin, $operation) {

  // Create a protected user.
  $protected_account = $this
    ->createProtectedUser([
    $plugin,
  ]);

  // Create operating account.
  $account = $this
    ->drupalCreateUser([
    'administer users',
    'userprotect.dummy.bypass',
  ]);

  // Test if account has the expected access.
  $this
    ->assertTrue($this->accessController
    ->access($protected_account, $operation, $account));
}