You are here

function EnableModuleWithoutDependencyTest::testEnableWithoutDependency in SimpleTest 6

File

tests/modules_system.test, line 103

Class

EnableModuleWithoutDependencyTest

Code

function testEnableWithoutDependency() {

  // Disable all modules for this test
  $current_modules = module_list(true, false);
  foreach ($current_modules as $module) {

    // We don't disable core modules
    if (!in_array($module, drupal_required_modules())) {
      $this
        ->drupalModuleDisable($module);
    }
  }

  // Attempt to enable forum module, which should fail because comment and taxonomy are not enabled
  $web_user = $this
    ->drupalCreateUserRolePerm(array(
    'access administration pages',
    'administer site configuration',
  ));
  $this
    ->drupalLoginUser($web_user);
  $edit = array(
    'status[forum]' => 'forum',
  );
  $this
    ->drupalPost('admin/build/modules/list/confirm', $edit, 'Save configuration');
  $this
    ->assertWantedRaw(t('Some required modules must be enabled'), t('Make sure the dependency error is shown'));
  $this
    ->assertFalse(module_exists('forum'), t('Check to make sure that the module has not somehow become enabled'));
}