function ModuleTestBase::assertModules
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertModules()
- 8.9.x core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\ModuleTestBase::assertModules()
- 8.9.x core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertModules()
- 11.x core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertModules()
Assert the list of modules are enabled or disabled.
Parameters
$modules: Module list to check.
$enabled: Expected module state.
9 calls to ModuleTestBase::assertModules()
- ConfigImportAllTest::testInstallUninstall in core/
modules/ config/ tests/ src/ Functional/ ConfigImportAllTest.php - Tests that a fixed set of modules can be installed and uninstalled.
- DependencyTest::testCoreCompatibility in core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php - Tests enabling modules with different core version specifications.
- DependencyTest::testCoreVersionContains8X in core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php - Tests the dependency checks when core version contains '8.x' within it.
- DependencyTest::testEnableRequirementsFailureDependency in core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php - Tests enabling a module that depends on a module which fails hook_requirements().
- DependencyTest::testEnableWithoutDependency in core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php - Attempts to enable the Content Translation module without Language enabled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ ModuleTestBase.php, line 135
Class
- ModuleTestBase
- Helper class for module test cases.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function assertModules(array $modules, $enabled) {
$this->rebuildContainer();
foreach ($modules as $module) {
if ($enabled) {
$message = 'Module "%s" is enabled.';
}
else {
$message = 'Module "%s" is not enabled.';
}
$this->assertEquals($enabled, $this->container
->get('module_handler')
->moduleExists($module), sprintf($message, $module));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.