3 namespace Drupal\Tests\system\Kernel;
5 use Drupal\KernelTests\KernelTestBase;
10 class PermissionsTest extends KernelTestBase {
15 public static $modules = [
21 * Tests the 'access content' permission is provided by the System module.
23 public function testAccessContentPermission() {
24 // Uninstalling modules requires the users_data table to exist.
25 $this->installSchema('user', ['users_data']);
27 $permissions = $this->container->get('user.permissions')->getPermissions();
28 $this->assertSame('system', $permissions['access content']['provider']);
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']);
34 $permissions = $this->container->get('user.permissions')->getPermissions();
35 $this->assertSame('system', $permissions['access content']['provider']);
37 // Uninstall the 'node' module, assert that it is again the 'system' module.
38 $this->container->get('module_installer')->uninstall(['node']);
40 $permissions = $this->container->get('user.permissions')->getPermissions();
41 $this->assertSame('system', $permissions['access content']['provider']);