function ModuleUninstallTestCase::testUserPermsUninstalled

Tests the hook_modules_uninstalled() of the user module.

File

modules/simpletest/tests/module.test, line 327

Class

ModuleUninstallTestCase
Unit tests for module uninstallation and related hooks.

Code

function testUserPermsUninstalled() {
    // Uninstalls the module_test module, so hook_modules_uninstalled()
    // is executed.
    module_disable(array(
        'module_test',
    ));
    drupal_uninstall_modules(array(
        'module_test',
    ));
    // Are the perms defined by module_test removed from {role_permission}.
    $count = db_query("SELECT COUNT(rid) FROM {role_permission} WHERE permission = :perm", array(
        ':perm' => 'module_test perm',
    ))->fetchField();
    $this->assertEqual(0, $count, 'Permissions were all removed.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.