? sites/default/files ? sites/default/settings.php Index: modules/system/system.test =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.test,v retrieving revision 1.12 diff -u -p -r1.12 system.test --- modules/system/system.test 15 Sep 2008 20:48:09 -0000 1.12 +++ modules/system/system.test 28 Sep 2008 03:00:46 -0000 @@ -26,83 +26,52 @@ class EnableDisableCoreTestCase extends } /** - * Enable a module, check the database for related tables, disable module, - * check for related tables, unistall module, check for related tables. + * Enable a module, with and without dependencies. */ function testEnableDisable() { - // Enable aggregator, and check tables. - $this->assertModules(array('aggregator'), FALSE); - $this->assertTableCount('aggregator', FALSE); + module_disable(array('aggregator', 'forum', 'comment', 'taxonomy')); + $this->assertModules(array('aggregator', 'forum', 'comment', 'taxonomy'), FALSE); - $edit = array(); + // Make sure enabling a module without a dependency works. $edit['modules[Core - optional][aggregator][enable]'] = 'aggregator'; $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); - $this->assertModules(array('aggregator'), TRUE); - $this->assertTableCount('aggregator', TRUE); - // Disable aggregator, check tables, uninstall aggregator, check tables. $edit = array(); - $edit['modules[Core - optional][aggregator][enable]'] = FALSE; + $edit['modules[Core - optional][forum][enable]'] = 'forum'; $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); + $this->assertText(t('You must enable the Taxonomy, Comment modules to install Forum.'), t("Confirmation page shows up.")); + $this->drupalPost(NULL, array(), t('Continue')); $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); - $this->assertModules(array('aggregator'), FALSE); - $this->assertTableCount('aggregator', TRUE); + $this->assertModules(array('forum', 'comment', 'taxonomy'), TRUE); - $edit = array(); - $edit['uninstall[aggregator]'] = 'aggregator'; - $this->drupalPost('admin/build/modules/uninstall', $edit, t('Uninstall')); + $this->drupalGet('admin/build/modules'); - $this->drupalPost(NULL, NULL, t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.')); - - $this->assertModules(array('aggregator'), FALSE); - $this->assertTableCount('aggregator', FALSE); - } + $this->assertXPath('//input[name="modules[Core - optional][comment][enable]"][disabled]', t('Disabling the comment module isn\'t allowed')); + $this->assertXPath('//input[name="modules[Core - optional][taxonomy][enable]"][disabled]', t('Disabling the taxonomy module isn\'t allowed')); - /** - * Attempt to enable translation module without locale enabled. - */ - function testEnableWithoutDependency () { - // Attempt to enable content translation without locale enabled. $edit = array(); - $edit['modules[Core - optional][translation][enable]'] = 'translation'; + $edit['modules[Core - optional][forum][enable]'] = FALSE; $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); - $this->assertText(t('Some required modules must be enabled'), t('Dependecy required.')); - - $this->assertModules(array('translation', 'locale'), FALSE); - - // Assert that the locale tables weren't enabled. - $this->assertTableCount('languages', FALSE); - $this->assertTableCount('locale', FALSE); - - $this->drupalPost(NULL, NULL, t('Continue')); $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + $this->assertModules(array('forum'), FALSE); + $this->assertModules(array('comment', 'taxonomy'), TRUE); - $this->assertModules(array('translation', 'locale'), TRUE); + $edit['modules[Core - optional][comment][enable]'] = FALSE; + $edit['modules[Core - optional][taxonomy][enable]'] = FALSE; + $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); + $this->assertModules(array('comment', 'taxonomy'), FALSE); - // Assert that the locale tables were enabled. - $this->assertTableCount('languages', TRUE); - $this->assertTableCount('locale', TRUE); + $edit['modules[Core - optional][comment][enable]'] = 'comment'; + $edit['modules[Core - optional][taxonomy][enable]'] = 'taxonomy'; + $edit['modules[Core - optional][forum][enable]'] = 'forum'; + $this->drupalPost('admin/build/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + $this->assertModules(array('forum', 'comment', 'taxonomy'), TRUE); } - /** - * Assert tables that begin with the specified base table name. - * - * @param string $base_table Begginning of table name to look for. - * @param boolean $count Assert tables that match specified base table. - * @return boolean Tables with specified base table. - */ - function assertTableCount($base_table, $count) { - $match_count = simpletest_get_like_tables($base_table, TRUE); - - if ($count) { - return $this->assertTrue($match_count, t('Tables matching "@base_table" found.', array('@base_table' => $base_table))); - } - return $this->assertFalse($match_count, t('Tables matching "@base_table" not found.', array('@base_table' => $base_table))); - } /** * Assert the list of modules are enabled or disabled.