1 system.test ModuleDependencyTestCase::testEnableRequirementsFailureDependency()

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

File

core/modules/system/tests/system.test, line 431
Tests for system.module.

Class

ModuleDependencyTestCase
Test module dependency functionality.

Code

function testEnableRequirementsFailureDependency() {
  // Enable comment module before testing the dependencies.
  $edit = array();
  $edit['modules[Comments][comment][enable]'] = TRUE;
  $this->backdropPost('admin/modules', $edit, t('Save configuration'));

  $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->backdropPost('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);

}