public function UserRoleEntityTest::testOrderOfPermissions in Drupal 8
Same name and namespace in other branches
- 9 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',
]);
}