public function FieldPermissionsCommentTest::setUp in Field Permissions 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/FieldPermissionsCommentTest.php \Drupal\Tests\field_permissions\Functional\FieldPermissionsCommentTest::setUp()
Overrides FieldPermissionsTestBase::setUp
File
- tests/
src/ Functional/ FieldPermissionsCommentTest.php, line 37
Class
- FieldPermissionsCommentTest
- Test field permissions with the comment module and fields.
Namespace
Drupal\Tests\field_permissions\FunctionalCode
public function setUp() {
parent::setUp();
// Add comment permissions to authenticated user.
$permissions = [
'post comments',
'skip comment approval',
'access comments',
'edit own comments',
];
foreach ($permissions as $permission) {
$this->limitUserRole
->grantPermission($permission);
}
$this->limitUserRole
->save();
// Allow the web user to access comments and administer comments. Private
// fields should still be hidden.
$this->webUserRole
->grantPermission('access comments')
->grantPermission('administer comments')
->save();
$this->fieldName = 'comment_body';
$this->commentSubject = 'Test subject comment';
$this->fieldText = 'A comment';
$this->entityDisplayRepository = $this->container
->get('entity_display.repository');
}