You are here

function ModuleDependencyTestCase::testEnableRequirementsFailureDependency in Drupal 7

Tests enabling a module that depends on a module which fails hook_requirements().

File

modules/system/system.test, line 488
Tests for system.module.

Class

ModuleDependencyTestCase
Test module dependency functionality.

Code

function testEnableRequirementsFailureDependency() {
  $this
    ->assertModules(array(
    'requirements1_test',
  ), FALSE);
  $this
    ->assertModules(array(
    'requirements2_test',
  ), FALSE);

  // Attempt to install both modules at the same time.
  $edit = array();
  $edit['modules[Testing][requirements1_test][enable]'] = 'requirements1_test';
  $edit['modules[Testing][requirements2_test][enable]'] = 'requirements2_test';
  $this
    ->drupalPost('admin/modules', $edit, t('Save configuration'));

  // Makes sure the modules were NOT installed.
  $this
    ->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
  $this
    ->assertModules(array(
    'requirements1_test',
  ), FALSE);
  $this
    ->assertModules(array(
    'requirements2_test',
  ), FALSE);

  // Makes sure that already enabled modules the failing modules depend on
  // were not disabled.
  $this
    ->assertModules(array(
    'comment',
  ), TRUE);
}