fdd69f52f5f959b8ca17b42cac49300df74b25ef
[yaffs-website] / web / core / modules / system / tests / src / Kernel / PermissionsTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6
7 /**
8  * @group system
9  */
10 class PermissionsTest extends KernelTestBase {
11
12   /**
13    * {@inheritdoc}
14    */
15   public static $modules = [
16     'system',
17     'user',
18   ];
19
20   /**
21    * Tests the 'access content' permission is provided by the System module.
22    */
23   public function testAccessContentPermission() {
24     // Uninstalling modules requires the users_data table to exist.
25     $this->installSchema('user', ['users_data']);
26
27     $permissions = $this->container->get('user.permissions')->getPermissions();
28     $this->assertSame('system', $permissions['access content']['provider']);
29
30     // Install the 'node' module, assert that it is now the 'node' module
31     // providing the 'access content' permission.
32     $this->container->get('module_installer')->install(['node']);
33
34     $permissions = $this->container->get('user.permissions')->getPermissions();
35     $this->assertSame('system', $permissions['access content']['provider']);
36
37     // Uninstall the 'node' module, assert that it is again the 'system' module.
38     $this->container->get('module_installer')->uninstall(['node']);
39
40     $permissions = $this->container->get('user.permissions')->getPermissions();
41     $this->assertSame('system', $permissions['access content']['provider']);
42   }
43
44 }