You are here

public function UninstallTest::testUserPermsUninstalled in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Module/UninstallTest.php \Drupal\Tests\system\Functional\Module\UninstallTest::testUserPermsUninstalled()
  2. 10 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 34

Class

UninstallTest
Tests the uninstallation of modules.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testUserPermsUninstalled() {

  // 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?
  $this
    ->assertEmpty(user_roles(FALSE, 'module_test perm'), 'Permissions were all removed.');
}