public function GroupAccessControlHandlerTest::testCreateAccess in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/GroupAccessControlHandlerTest.php \Drupal\Tests\group\Kernel\GroupAccessControlHandlerTest::testCreateAccess()
Tests the behavior of create access for groups.
@covers ::checkCreateAccess
File
- tests/
src/ Kernel/ GroupAccessControlHandlerTest.php, line 133
Class
- GroupAccessControlHandlerTest
- Tests the general access behavior of group entities.
Namespace
Drupal\Tests\group\KernelCode
public function testCreateAccess() {
$access_control_handler = $this->entityTypeManager
->getAccessControlHandler('group');
$this
->assertFalse($access_control_handler
->createAccess('foo'), 'A user without the right permission has no access');
$access_control_handler
->resetCache();
$this->entityTypeManager
->getStorage('user_role')
->load('authenticated')
->grantPermission('create foo group')
->save();
$this
->assertTrue($access_control_handler
->createAccess('foo'), 'A user with the right permission has access');
}