comparison core/modules/user/tests/src/Kernel/UserRoleEntityTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Tests\user\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\user\Entity\Role;
7
8 /**
9 * @group user
10 */
11 class UserRoleEntityTest extends KernelTestBase {
12
13 public static $modules = ['system', 'user'];
14
15 public function testOrderOfPermissions() {
16 $role = Role::create(['id' => 'test_role']);
17 $role->grantPermission('b')
18 ->grantPermission('a')
19 ->grantPermission('c')
20 ->save();
21 $this->assertEquals($role->getPermissions(), ['a', 'b', 'c']);
22
23 $role->revokePermission('b')->save();
24 $this->assertEquals($role->getPermissions(), ['a', 'c']);
25
26 $role->grantPermission('b')->save();
27 $this->assertEquals($role->getPermissions(), ['a', 'b', 'c']);
28 }
29
30 }