From 3da6b9843597985ec48881bf1ef13f2df2c3a06a Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 17 Sep 2012 12:30:00 +0100 Subject: [PATCH] Issue #1460764 by klausi: Missing test coverage for a D7 install with non-required modules installed but disabled. --- .../ModulesDisabledUpgradePathTest.php | 57 +++++++++++++++++++ .../drupal-7.all-disabled.database.php | 20 +++++++ 2 files changed, 77 insertions(+) create mode 100644 core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php create mode 100644 core/modules/system/tests/upgrade/drupal-7.all-disabled.database.php diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php new file mode 100644 index 00000000000..c4c6f755291 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php @@ -0,0 +1,57 @@ + 'Modules disabled upgrade test', + 'description' => 'Upgrade path test for disabled modules.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + $this->databaseDumpFiles = array( + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.standard_all.database.php.gz', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.all-disabled.database.php', + ); + parent::setUp(); + } + + /** + * Tests an upgrade with all non-required modules installed but disabled. + */ + public function testDisabledUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Get enabled modules. + $enabled = module_list(); + // Get all available modules. + $available = system_rebuild_module_data(); + // Filter out hidden test modules. + foreach ($available as $module => $data) { + if (!empty($data->info['hidden'])) { + unset($available[$module]); + } + } + $to_enable = array_diff_key($available, $enabled); + module_enable(array_keys($to_enable)); + // Check for updates. + require_once DRUPAL_ROOT . '/core/includes/update.inc'; + require_once DRUPAL_ROOT . '/core/includes/install.inc'; + $updates = update_get_update_list(); + $this->assertEqual($updates, array(), 'No pending updates after enabling all modules.'); + } +} diff --git a/core/modules/system/tests/upgrade/drupal-7.all-disabled.database.php b/core/modules/system/tests/upgrade/drupal-7.all-disabled.database.php new file mode 100644 index 00000000000..26b819ef39e --- /dev/null +++ b/core/modules/system/tests/upgrade/drupal-7.all-disabled.database.php @@ -0,0 +1,20 @@ +fields(array( + 'status' => 0, + )) + ->condition('type', 'module') + ->condition('name', array('filter', 'field', 'field_sql_storage', 'entity', + 'system', 'text', 'user'), 'NOT IN') + ->execute();