public function ViewsFieldAccessTest::testCustomPermissions in Field Permissions 8
Same name and namespace in other branches
- 8.2 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\KernelCode
public function testCustomPermissions() {
$this->fieldStorage
->setThirdPartySetting('field_permissions', 'permission_type', FieldPermissionTypeInterface::ACCESS_CUSTOM)
->save();
$this->roleWithAccess
->grantPermission('view ' . $this->fieldStorage
->getName())
->save();
$this
->assertFieldAccess();
}