You are here

protected function KernelTestBase::installConfig in SimpleTest 8.3

Installs default configuration for a given list of modules.

Parameters

array $modules: A list of modules for which to install default configuration.

Throws

\RuntimeException Thrown when any module listed in $modules is not enabled.

1 call to KernelTestBase::installConfig()
KernelTestBaseTest::testInstallConfig in src/Tests/KernelTestBaseTest.php
Tests expected behavior of installConfig().

File

src/KernelTestBase.php, line 430

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\simpletest

Code

protected function installConfig(array $modules) {
  foreach ($modules as $module) {
    if (!$this->container
      ->get('module_handler')
      ->moduleExists($module)) {
      throw new \RuntimeException("'{$module}' module is not enabled");
    }
    \Drupal::service('config.installer')
      ->installDefaultConfig('module', $module);
  }
  $this
    ->pass(new FormattableMarkup('Installed default config: %modules.', [
    '%modules' => implode(', ', $modules),
  ]));
}