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