class PermissionsTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/PermissionsTest.php \Drupal\Tests\system\Kernel\PermissionsTest
- 11.x core/modules/user/tests/src/Unit/Plugin/views/field/PermissionsTest.php \Drupal\Tests\user\Unit\Plugin\views\field\PermissionsTest
- 10 core/modules/system/tests/src/Kernel/PermissionsTest.php \Drupal\Tests\system\Kernel\PermissionsTest
- 10 core/modules/user/tests/src/Unit/Plugin/views/field/PermissionsTest.php \Drupal\Tests\user\Unit\Plugin\views\field\PermissionsTest
- 8.9.x core/modules/system/tests/src/Kernel/PermissionsTest.php \Drupal\Tests\system\Kernel\PermissionsTest
@group system
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\PermissionsTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of PermissionsTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ PermissionsTest.php, line 10
Namespace
Drupal\Tests\system\KernelView source
class PermissionsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'user',
];
/**
* Tests the 'access content' permission is provided by the System module.
*/
public function testAccessContentPermission() {
// Uninstalling modules requires the users_data table to exist.
$this->installSchema('user', [
'users_data',
]);
$permissions = $this->container
->get('user.permissions')
->getPermissions();
$this->assertSame('system', $permissions['access content']['provider']);
// Install the 'node' module, assert that it is now the 'node' module
// providing the 'access content' permission.
$this->container
->get('module_installer')
->install([
'node',
]);
$permissions = $this->container
->get('user.permissions')
->getPermissions();
$this->assertSame('system', $permissions['access content']['provider']);
// Uninstall the 'node' module, assert that it is again the 'system' module.
$this->container
->get('module_installer')
->uninstall([
'node',
]);
$permissions = $this->container
->get('user.permissions')
->getPermissions();
$this->assertSame('system', $permissions['access content']['provider']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.