You are here

public function ProtectionRuleUnitTest::testHasProtection in User protect 8

Tests hasProtection().

File

tests/src/Kernel/Entity/ProtectionRuleUnitTest.php, line 197

Class

ProtectionRuleUnitTest
Various unit tests for protection rules.

Namespace

Drupal\Tests\userprotect\Kernel\Entity

Code

public function testHasProtection() {

  // The protection rule was created with only the protection "user_mail"
  // enabled.
  $this
    ->assertTrue($this->protectionRule
    ->hasProtection('user_mail'));
  $this
    ->assertFalse($this->protectionRule
    ->hasProtection('user_name'));
  $this
    ->assertFalse($this->protectionRule
    ->hasProtection('non_existing_plugin_id'));
}