protected function FieldPermissionsCommentTest::setCommentFieldPermissions in Field Permissions 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/FieldPermissionsCommentTest.php \Drupal\Tests\field_permissions\Functional\FieldPermissionsCommentTest::setCommentFieldPermissions()
Change the field permission to a given type via the UI.
Parameters
string $perm: The permission type to set.
array $custom_permission: The permissions to set.
string $path: The path for the field edit form.
3 calls to FieldPermissionsCommentTest::setCommentFieldPermissions()
- FieldPermissionsCommentTest::checkCustomCommentField in tests/
src/ Functional/ FieldPermissionsCommentTest.php - Tests the comment field with custom permissions.
- FieldPermissionsCommentTest::checkPrivateCommentField in tests/
src/ Functional/ FieldPermissionsCommentTest.php - Tests the comment field when set to private.
- FieldPermissionsCommentTest::checkPrivateFieldPermission in tests/
src/ Functional/ FieldPermissionsCommentTest.php - Tests access to private field permission.
File
- tests/
src/ Functional/ FieldPermissionsCommentTest.php, line 173
Class
- FieldPermissionsCommentTest
- Test field permissions with the comment module and fields.
Namespace
Drupal\Tests\field_permissions\FunctionalCode
protected function setCommentFieldPermissions($perm, array $custom_permission, $path) {
$this
->drupalGet($path);
if ($perm === FieldPermissionTypeInterface::ACCESS_PUBLIC || $perm === FieldPermissionTypeInterface::ACCESS_PRIVATE) {
$edit = [
'type' => $perm,
];
$this
->submitForm($edit, 'Save settings');
}
elseif ($perm === FieldPermissionTypeInterface::ACCESS_CUSTOM && !empty($custom_permission)) {
$custom_permission['type'] = $perm;
$this
->submitForm($custom_permission, 'Save settings');
}
}