You are here

function ModuleTestCase::assertModules in Drupal 7

Assert the list of modules are enabled or disabled.

Parameters

$modules: Module list to check.

$enabled: Expected module state.

9 calls to ModuleTestCase::assertModules()
EnableDisableTestCase::assertSuccessfulDisableAndUninstall in modules/system/system.test
Disables and uninstalls a module and asserts that it was done correctly.
EnableDisableTestCase::testEnableDisable in modules/system/system.test
Test that all core modules can be enabled, disabled and uninstalled.
HookRequirementsTestCase::testHookRequirementsFailure in modules/system/system.test
Assert that a module cannot be installed if it fails hook_requirements().
ModuleDependencyTestCase::testEnableRequirementsFailureDependency in modules/system/system.test
Tests enabling a module that depends on a module which fails hook_requirements().
ModuleDependencyTestCase::testEnableWithoutDependency in modules/system/system.test
Attempt to enable translation module without locale enabled.

... See full list

File

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

Class

ModuleTestCase
Helper class for module test cases.

Code

function assertModules(array $modules, $enabled) {
  module_list(TRUE);
  foreach ($modules as $module) {
    if ($enabled) {
      $message = 'Module "@module" is enabled.';
    }
    else {
      $message = 'Module "@module" is not enabled.';
    }
    $this
      ->assertEqual(module_exists($module), $enabled, format_string($message, array(
      '@module' => $module,
    )));
  }
}