You are here

protected function FieldPermissionsNodeTest::checkViewEditAllField in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FieldPermissionsNodeTest.php \Drupal\Tests\field_permissions\Functional\FieldPermissionsNodeTest::checkViewEditAllField()

Test - view edit all field.

1 call to FieldPermissionsNodeTest::checkViewEditAllField()
FieldPermissionsNodeTest::testNodeFieldPermissions in tests/src/Functional/FieldPermissionsNodeTest.php
Test field permissions on nodes.

File

tests/src/Functional/FieldPermissionsNodeTest.php, line 232

Class

FieldPermissionsNodeTest
Test field permissions on nodes.

Namespace

Drupal\Tests\field_permissions\Functional

Code

protected function checkViewEditAllField() {
  $this
    ->drupalLogin($this->webUser);
  $this
    ->assertNodeFieldHidden();
  $this
    ->assertNodeFieldEditNoAccess();
  $this
    ->drupalLogout();
  $permission = [];
  $permission = $this
    ->grantCustomPermissions($this->webUserRole, [
    'view body',
    'edit body',
  ], $permission);
  $this
    ->setNodeFieldPermissions(FieldPermissionTypeInterface::ACCESS_CUSTOM, $permission);
  $this
    ->drupalLogin($this->webUser);
  $this
    ->assertNodeFieldVisible();
  $this
    ->assertNodeFieldEditAccess();
  $this
    ->drupalLogout();
}