You are here

public function ProtectionRuleUnitTest::testToArray in User protect 8

Tests toArray().

File

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

Class

ProtectionRuleUnitTest
Various unit tests for protection rules.

Namespace

Drupal\Tests\userprotect\Kernel\Entity

Code

public function testToArray() {
  $array = $this->protectionRule
    ->toArray();
  $this
    ->assertIdentical('dummy', $array['name']);
  $this
    ->assertIdentical('Dummy', $array['label']);
  $expected_protections = [
    'user_mail' => [
      'status' => TRUE,
    ],
  ];
  $this
    ->assertIdentical($expected_protections, $array['protections']);
  $this
    ->assertIdentical('user_role', $array['protectedEntityTypeId']);
  $this
    ->assertIdentical('administrator', $array['protectedEntityId']);
}