You are here

public function TestModuleContext::install in Lightning Core 8.5

Same name and namespace in other branches
  1. 8 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

Behat\Behat\Hook\Scope\BeforeScenarioScope $scope: The scenario scope.

File

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

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) {

    // Bootstrap Drupal if needed.
    $driver = $this
      ->getDriver();
    if (!$driver
      ->isBootstrapped()) {
      $driver
        ->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);
  }
}