function UninstallTest::testUserPermsUninstalled
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testUserPermsUninstalled()
- 8.9.x core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testUserPermsUninstalled()
- 11.x core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testUserPermsUninstalled()
Tests the hook_modules_uninstalled() of the user module.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ UninstallTest.php, line 35
Class
- UninstallTest
- Tests the uninstallation of modules.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testUserPermsUninstalled() : void {
// Uninstalls the module_test module, so hook_modules_uninstalled()
// is executed.
$this->container
->get('module_installer')
->uninstall([
'module_test',
]);
// Are the perms defined by module_test removed?
$roles = array_filter(Role::loadMultiple(), fn(RoleInterface $role) => $role->hasPermission('module_test perm'));
$this->assertEmpty($roles, 'Permissions were all removed.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.