Issue #1460764 by klausi: Missing test coverage for a D7 install with non-required modules installed but disabled.

8.0.x
catch 2012-09-17 12:30:00 +01:00
parent ded5c02ea8
commit 3da6b98435
2 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,57 @@
<?php
/**
* @file
* Definition of Drupal\system\Tests\Upgrade\ModulesDisabledUpgradePathTest.
*/
namespace Drupal\system\Tests\Upgrade;
/**
* Tests upgrading with all non-required modules installed but disabled.
*
* Loads a filled installation of Drupal 7 with disabled modules and runs the
* upgrade process on it.
*/
class ModulesDisabledUpgradePathTest extends UpgradePathTestBase {
public static function getInfo() {
return array(
'name' => '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.');
}
}

View File

@ -0,0 +1,20 @@
<?php
/**
* @file
* Database additions for upgrade path tests when all non-required modules are
* disabled.
*
* The drupal-7.filled.standard_all.database.php file is imported before
* this dump, so the two form the database structure expected in tests
* altogether.
*/
db_update('system')
->fields(array(
'status' => 0,
))
->condition('type', 'module')
->condition('name', array('filter', 'field', 'field_sql_storage', 'entity',
'system', 'text', 'user'), 'NOT IN')
->execute();