You are here

function ModuleTestBase::assertModules in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\ModuleTestBase::assertModules()

Assert the list of modules are enabled or disabled.

Parameters

$modules: Module list to check.

$enabled: Expected module state.

10 calls to ModuleTestBase::assertModules()
ConfigImportAllTest::testInstallUninstall in core/modules/config/src/Tests/ConfigImportAllTest.php
Tests that a fixed set of modules can be installed and uninstalled.
DependencyTest::testEnableRequirementsFailureDependency in core/modules/system/src/Tests/Module/DependencyTest.php
Tests enabling a module that depends on a module which fails hook_requirements().
DependencyTest::testEnableWithoutDependency in core/modules/system/src/Tests/Module/DependencyTest.php
Attempts to enable the Content Translation module without Language enabled.
DependencyTest::testModuleEnableOrder in core/modules/system/src/Tests/Module/DependencyTest.php
Tests that module dependencies are enabled in the correct order in the UI.
DependencyTest::testProjectNamespaceForDependencies in core/modules/system/src/Tests/Module/DependencyTest.php
Checks functionality of project namespaces for dependencies.

... See full list

File

core/modules/system/src/Tests/Module/ModuleTestBase.php, line 153
Contains \Drupal\system\Tests\Module\ModuleTestBase.

Class

ModuleTestBase
Helper class for module test cases.

Namespace

Drupal\system\Tests\Module

Code

function assertModules(array $modules, $enabled) {
  $this
    ->rebuildContainer();
  foreach ($modules as $module) {
    if ($enabled) {
      $message = 'Module "@module" is enabled.';
    }
    else {
      $message = 'Module "@module" is not enabled.';
    }
    $this
      ->assertEqual($this->container
      ->get('module_handler')
      ->moduleExists($module), $enabled, format_string($message, array(
      '@module' => $module,
    )));
  }
}