function ModuleDependencyTestCase::testEnableRequirementsFailureDependency

7.x system.test ModuleDependencyTestCase::testEnableRequirementsFailureDependency()

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

File

drupal-7.x/modules/system/system.test, line 476
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);

}