You are here

public function TestModuleContext::install in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 tests/contexts/TestModuleContext.behat.inc \Acquia\LightningExtension\Context\TestModuleContext::install()
  2. 8.2 tests/contexts/TestModuleContext.behat.inc \Acquia\LightningExtension\Context\TestModuleContext::install()
  3. 8.3 tests/contexts/TestModuleContext.behat.inc \Acquia\LightningExtension\Context\TestModuleContext::install()
  4. 8.4 tests/contexts/TestModuleContext.behat.inc \Acquia\LightningExtension\Context\TestModuleContext::install()

Installs test modules for this scenario.

@BeforeScenario

Parameters

BeforeScenarioScope $scope: The scenario scope.

File

tests/contexts/TestModuleContext.behat.inc, line 48

Class

TestModuleContext
Allows test modules to be installed during a scenario and uninstalled after.

Namespace

Acquia\LightningExtension\Context

Code

public function install(BeforeScenarioScope $scope) {
  $modules = $this
    ->getModules($scope);
  if ($modules) {
    $this
      ->getDriver()
      ->bootstrap();

    // Ensure that test directories are scanned for modules.
    $settings = Settings::getAll();
    $settings['extension_discovery_scan_tests'] = TRUE;
    new Settings($settings);
    \Drupal::service('module_installer')
      ->install($modules);
  }
}