1 system.test | ModuleDependencyTestCase::testMissingModules() |
Attempt to enable a module with a missing dependency.
File
- core/
modules/ system/ tests/ system.test, line 376 - Tests for system.module.
Class
- ModuleDependencyTestCase
- Test module dependency functionality.
Code
function testMissingModules() {
// Test that the system_dependencies_test module is marked
// as missing a dependency.
$this->backdropGet('admin/modules');
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => backdrop_ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
// Force enable the system_dependencies_test module.
module_enable(array('system_dependencies_test'), FALSE);
// Verify that the module is forced to be disabled when submitting
// the module page.
$this->backdropPost('admin/modules', array(), t('Save configuration'));
$this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), 'The module missing dependencies will be disabled.');
// Confirm.
$this->backdropPost(NULL, NULL, t('Continue'));
// Verify that the module has been disabled.
$this->assertModules(array('system_dependencies_test'), FALSE);
}