summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/module.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-01 08:39:56 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-01 08:39:56 +0000
commitfb125851a3cc5aa494ee315a5d7d129e2995a81f (patch)
tree2ce7881a22bba6bbd5cd97c211f88dfb6e483ed9 /modules/simpletest/tests/module.test
parent8eb8dcc8425295d1a4278613031812bff7d98c15 (diff)
downloadbrdo-fb125851a3cc5aa494ee315a5d7d129e2995a81f.tar.gz
brdo-fb125851a3cc5aa494ee315a5d7d129e2995a81f.tar.bz2
- Patch #306027 by agentrickard, catch, dereine, Dave Reid, drewish, et al: automatically clean the {role_permission} table when modules are uninstalled.
Diffstat (limited to 'modules/simpletest/tests/module.test')
-rw-r--r--modules/simpletest/tests/module.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test
index 9d3673673..da12b5504 100644
--- a/modules/simpletest/tests/module.test
+++ b/modules/simpletest/tests/module.test
@@ -77,3 +77,33 @@ class ModuleUnitTest extends DrupalWebTestCase {
$this->assertIdentical($expected_values, module_list(FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition)));
}
}
+
+/**
+ * Unit tests for module uninstallation and related hooks.
+ */
+class ModuleUninstallTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => t('Module uninstallation'),
+ 'description' => t('Checks module uninstallation'),
+ 'group' => t('Module'),
+ );
+ }
+
+ function setUp() {
+ parent::setUp('module_test', 'user');
+ }
+
+ /**
+ * Tests the hook_modules_uninstalled() of the user module.
+ */
+ function testUserPermsUninstalled() {
+ // Uninstalls the module_test module, so hook_modules_uninstalled()
+ // is executed.
+ 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, t('Permissions were all removed.'));
+ }
+}