You are here

public function ViewsFieldAccessTest::testCustomPermissions in Field Permissions 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/ViewsFieldAccessTest.php \Drupal\Tests\field_permissions\Kernel\ViewsFieldAccessTest::testCustomPermissions()

Tests custom permissions.

File

tests/src/Kernel/ViewsFieldAccessTest.php, line 159

Class

ViewsFieldAccessTest
Test that custom and private field access works with views.

Namespace

Drupal\Tests\field_permissions\Kernel

Code

public function testCustomPermissions() {
  $this->fieldStorage
    ->setThirdPartySetting('field_permissions', 'permission_type', FieldPermissionTypeInterface::ACCESS_CUSTOM)
    ->save();
  $this->roleWithAccess
    ->grantPermission('view ' . $this->fieldStorage
    ->getName())
    ->save();
  $this
    ->assertFieldAccess();
}