public function GroupContentCreateAccessTest::testFormAccess in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/GroupContentCreateAccessTest.php \Drupal\Tests\group\Kernel\GroupContentCreateAccessTest::testFormAccess()
Tests access to the create/add form.
@dataProvider formAccessProvider
File
- tests/
src/ Kernel/ GroupContentCreateAccessTest.php, line 189
Class
- GroupContentCreateAccessTest
- Tests the group content create access for groups.
Namespace
Drupal\Tests\group\KernelCode
public function testFormAccess($route, $outsider_permissions, $member_permissions, $outsider_access, $member_access, $admin_access, $message) {
$outsider = $this
->createUser();
$member = $this
->createUser();
$admin = $this
->createUser();
$this->groupType
->getOutsiderRole()
->grantPermissions($outsider_permissions)
->save();
$this->groupType
->getMemberRole()
->grantPermissions($member_permissions)
->save();
$group = $this
->createGroup([
'type' => $this->groupType
->id(),
]);
$group
->addMember($member);
$group
->addMember($admin, [
'group_roles' => [
$this->adminRole
->id(),
],
]);
$request = $this
->createRequest($route, $group, 'entity_test_as_content');
$this
->assertSame($outsider_access, $this->accessManager
->checkRequest($request, $outsider), $message);
$this
->assertSame($member_access, $this->accessManager
->checkRequest($request, $member), $message);
$this
->assertSame($admin_access, $this->accessManager
->checkRequest($request, $admin), $message);
}