protected function FixtureBase::installModule in Lightning Core 8.5
Same name and namespace in other branches
- 8.3 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::installModule()
- 8.4 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::installModule()
Installs a module if not already present.
Parameters
string $module: The machine name of the module to install.
Return value
bool TRUE if the module was installed, FALSE otherwise.
File
- tests/
src/ FixtureBase.php, line 156
Class
- FixtureBase
- Base class for contexts which set up and tear down a complete test fixture.
Namespace
Drupal\Tests\lightning_coreCode
protected function installModule($module) {
// The container may contain stale data, so we need to update our reference
// to it.
$this
->resetContainer();
if ($this->container
->get('module_handler')
->moduleExists($module)) {
return FALSE;
}
$installed = $this->container
->get('module_installer')
->install([
$module,
]);
if ($installed) {
array_push($this->modules, $module);
// The container has changed after module installation, so we need to
// update our reference to it.
$this
->resetContainer();
}
return $installed;
}