function UserRoleEntityTest::testPermissionRevokeAndConfigSync
Same name in other branches
- 9 core/modules/user/tests/src/Kernel/UserRoleEntityTest.php \Drupal\Tests\user\Kernel\UserRoleEntityTest::testPermissionRevokeAndConfigSync()
- 10 core/modules/user/tests/src/Kernel/UserRoleEntityTest.php \Drupal\Tests\user\Kernel\UserRoleEntityTest::testPermissionRevokeAndConfigSync()
File
-
core/
modules/ user/ tests/ src/ Kernel/ UserRoleEntityTest.php, line 53
Class
- UserRoleEntityTest
- @group user @coversDefaultClass \Drupal\user\Entity\Role
Namespace
Drupal\Tests\user\KernelCode
public function testPermissionRevokeAndConfigSync() : void {
$role = Role::create([
'id' => 'test_role',
'label' => 'Test role',
]);
$role->setSyncing(TRUE);
$role->grantPermission('a')
->grantPermission('b')
->grantPermission('c')
->save();
$this->assertSame([
'a',
'b',
'c',
], $role->getPermissions());
$role->revokePermission('b')
->save();
$this->assertSame([
'a',
'c',
], $role->getPermissions());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.