diff options
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r-- | modules/simpletest/tests/module.test | 30 | ||||
-rw-r--r-- | modules/simpletest/tests/module_test.info | 8 | ||||
-rw-r--r-- | modules/simpletest/tests/module_test.module | 11 |
3 files changed, 49 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.')); + } +} diff --git a/modules/simpletest/tests/module_test.info b/modules/simpletest/tests/module_test.info new file mode 100644 index 000000000..09a2afa67 --- /dev/null +++ b/modules/simpletest/tests/module_test.info @@ -0,0 +1,8 @@ +; $Id$ +name = "Module test" +description = "Support module for module system testing." +package = Testing +version = VERSION +core = 7.x +files[] = module_test.module +hidden = TRUE diff --git a/modules/simpletest/tests/module_test.module b/modules/simpletest/tests/module_test.module new file mode 100644 index 000000000..33dd979c1 --- /dev/null +++ b/modules/simpletest/tests/module_test.module @@ -0,0 +1,11 @@ +<?php +// $Id$ + +/** + * Implement hook_perm(). + */ +function module_test_perm() { + return array( + 'module_test perm' => t('example perm for module_test module'), + ); +} |