? .bzr ? node_format.patch ? simpletest ? simplified_modules.patch ? system_tests.patch ? upload.patch ? x.php ? tests/homepage.test ? tests/menu_enable.patch ? tests/menu_tests.patch ? tests/functional/profile_cleanup.tst Index: drupal_test_case.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_test_case.php,v retrieving revision 1.83 diff -u -p -r1.83 drupal_test_case.php --- drupal_test_case.php 5 Apr 2008 19:19:26 -0000 1.83 +++ drupal_test_case.php 6 Apr 2008 20:47:38 -0000 @@ -190,6 +190,7 @@ class DrupalTestCase extends UnitTestCas menu_rebuild(); cache_clear_all('schema', 'cache'); module_rebuild_cache(); + $this->assertTrue(module_exists($module), t('@module is enabled', array('@module' => $module))); } /** @@ -204,8 +205,9 @@ class DrupalTestCase extends UnitTestCas $this->pass(" [module] $name already disabled"); return TRUE; } - unset($this->_modules[$key]); + unset($this->_modules[$name]); $form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration')); + include_once drupal_get_path('module', 'system') .'/system.admin.inc'; drupal_execute('system_modules', $form_state); //rebuilding all caches @@ -214,6 +216,7 @@ class DrupalTestCase extends UnitTestCas menu_rebuild(); cache_clear_all('schema', 'cache'); module_rebuild_cache(); + $this->assertFalse(module_exists($module), t('@module is disabled', array('@module' => $module))); } /** @@ -348,7 +351,7 @@ class DrupalTestCase extends UnitTestCas * Generates a random database prefix and runs the install scripts on the prefixed database. * After installation many caches are flushed and the internal browser is setup so that the page * requests will run on the new prefix. - * + * * @param ... List modules to enable. */ function setUp() { Index: tests/functional/system.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/system.test,v retrieving revision 1.9 diff -u -p -r1.9 system.test --- tests/functional/system.test 1 Apr 2008 23:33:54 -0000 1.9 +++ tests/functional/system.test 6 Apr 2008 20:47:39 -0000 @@ -27,7 +27,6 @@ class EnableCoreModuleTestCase extends D 'openid', 'path', 'php', - 'ping', 'poll', 'profile', 'search', @@ -43,7 +42,7 @@ class EnableCoreModuleTestCase extends D ); // Get a list of the currently enabled modules - $enabled_modules = module_list(true, false); + $enabled_modules = module_list(TRUE, FALSE); $web_user = $this->drupalCreateUser(array ( 'access administration pages', @@ -54,42 +53,28 @@ class EnableCoreModuleTestCase extends D $edit = array(); // We temporarily disable any modules we're testing so that we can re-enable them for testing foreach ($modules_to_enable as $module) { - if (module_exists($module)) + if (module_exists($module)) { $this->drupalModuleDisable($module); - + } $edit['status['. $module .']'] = $module; } $this->drupalPost('admin/build/modules/list/confirm', $edit, t('Save configuration')); - $this->assertRaw(t('The configuration options have been saved.'), t('Ensure that the module status has been updated')); + $this->assertRaw(t('The configuration options have been saved.'), t('Module status has been updated')); // Now, we check the tables for each module // We also refresh the module list and make sure the modules are enabled - module_list(true, false); + module_list(TRUE, FALSE); foreach ($modules_to_enable as $module) { - $cur_schema = drupal_get_schema_unprocessed($module); + $current_schema = drupal_get_schema_unprocessed($module); - $tables = is_array($cur_schema) ? array_keys($cur_schema) : array(); + $tables = is_array($current_schema) ? array_keys($current_schema) : array(); foreach ($tables as $table) - $this->assertTrue(db_table_exists($table), t('Make sure that the database table for the module exists')); - - $this->assertTrue(module_exists($module), t('Check to see that the module is actually enabled')); - } - - // Disable/uninstall all the modules that have been installed by this process - // We first need to refresh the module list - include_once './includes/install.inc'; + $this->assertTrue(db_table_exists($table), t('The database table for the module exists')); - foreach ($modules_to_enable as $module) { - // We uninstall the modules that weren't already enabled - if (!in_array($module, $enabled_modules)) { - module_disable(array($module)); - drupal_uninstall_module($module); - } + $this->assertTrue(module_exists($module), t('@module is enabled', array('@module' => $module))); } - drupal_clear_css_cache(); - drupal_clear_js_cache(); } } @@ -103,11 +88,12 @@ class EnableModuleWithoutDependencyTestC function testEnableWithoutDependency () { // Disable all modules for this test - $current_modules = module_list(true, false); + $current_modules = module_list(TRUE, FALSE); foreach ($current_modules as $module) { // We don't disable core modules - if (!in_array($module, drupal_required_modules())) + if (!in_array($module, drupal_required_modules())) { $this->drupalModuleDisable($module); + } } // Attempt to enable forum module, which should fail because comment and taxonomy are not enabled @@ -154,7 +140,6 @@ class DisableUninstallCoreModuleTestCase 'openid', 'path', 'php', - 'ping', 'poll', 'profile', 'search', @@ -170,7 +155,7 @@ class DisableUninstallCoreModuleTestCase ); // Get a list of the currently enabled modules - $enabled_modules = module_list(true, false); + $enabled_modules = module_list(TRUE, FALSE); // We don't want to test any modules that are already enabled, since that would involve a loss of data foreach ($enabled_modules as $module) { @@ -190,8 +175,11 @@ class DisableUninstallCoreModuleTestCase $this->drupalLogin($web_user); // Disable/uninstall the given modules: we keep every other module enabled - // We do this loop because for each level of dependency, we need one more request - while (count(array_diff(module_list(true, false), $enabled_modules)) > 0) { + // We do this loop because for each level of dependency, we need one more + // request. In order to avoid an infite loop, we do not execute more than + // 10 loops. + $counter = 10; + while (count(array_diff(module_list(TRUE, FALSE), $enabled_modules)) > 0 && $counter--) { $edit = array(); foreach ($modules_to_test as $module) { $edit['status['. $module .']'] = 0; @@ -201,11 +189,11 @@ class DisableUninstallCoreModuleTestCase } $this->drupalPost('admin/build/modules/list/confirm', $edit, t('Save configuration')); - $this->assertRaw(t('The configuration options have been saved.'), t('Ensure that the module status has been updated')); + $this->assertRaw(t('The configuration options have been saved.'), t('Module status has been updated')); } // Now, lets make sure the modules are truly disabled and then try to uninstall them - module_list(true, false); + module_list(TRUE, FALSE); $edit = array(); foreach ($modules_to_test as $module) { $this->assertFalse(module_exists($module), t('Make sure the module has been disabled')); @@ -217,18 +205,16 @@ class DisableUninstallCoreModuleTestCase $this->drupalPost('admin/build/modules/uninstall/confirm', $edit, t('Uninstall')); // We need to confirm this by clicking again $this->drupalPost(NULL, array(), t('Uninstall')); - $this->assertRaw(t('The selected modules have been uninstalled.'), 'Check to ensure that the modules have been removed'); + $this->assertRaw(t('The selected modules have been uninstalled.'), 'Modules have been removed'); // Now, we check the tables for each module foreach ($modules_to_test as $module) { - $cur_schema = drupal_get_schema_unprocessed($module); + $current_schema = drupal_get_schema_unprocessed($module); - $tables = is_array($cur_schema) ? array_keys($cur_schema) : array(); - foreach ($tables as $table) - $this->assertFalse(db_table_exists($table), t('Ensure that the database table has been properly removed')); + $tables = is_array($current_schema) ? array_keys($current_schema) : array(); + foreach ($tables as $table) { + $this->assertFalse(db_table_exists($table), t('Database table @table has been properly removed', array('@table' => $table))); + } } - - drupal_clear_css_cache(); - drupal_clear_js_cache(); } }