You are here

protected function KernelTestBase::installConfig in Zircon Profile 8

Same name in this branch
  1. 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installConfig()
  2. 8 core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::installConfig()
Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::installConfig()

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.

156 calls to KernelTestBase::installConfig()
AggregatorTitleTest::setUp in core/modules/aggregator/src/Tests/AggregatorTitleTest.php
Performs setup tasks before each individual test method is run.
AreaEntityTest::setUpFixtures in core/modules/views/src/Tests/Handler/AreaEntityTest.php
Sets up the configuration and schema of views and views_test_data modules.
AreaTextTest::setUp in core/modules/views/src/Tests/Handler/AreaTextTest.php
Performs setup tasks before each individual test method is run.
BlockStorageUnitTest::testDefaultBlocks in core/modules/block/src/Tests/BlockStorageUnitTest.php
Tests the installation of default blocks.
BookUninstallTest::setUp in core/modules/book/src/Tests/BookUninstallTest.php
Performs setup tasks before each individual test method is run.

... See full list

File

core/modules/simpletest/src/KernelTestBase.php, line 399
Contains \Drupal\simpletest\KernelTestBase.

Class

KernelTestBase
Base class for 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(format_string('Installed default config: %modules.', array(
    '%modules' => implode(', ', $modules),
  )));
}