function KernelTestBase::installConfig

Same name in this branch
  1. 8.9.x core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::installConfig()
Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installConfig()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installConfig()
  3. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installConfig()

Installs default configuration for a given list of modules.

Parameters

string|string[] $modules: A module or list of modules for which to install default configuration.

Throws

\LogicException If any module in $modules is not enabled.

34 calls to KernelTestBase::installConfig()
ConfigEntityAdapterTest::setUp in core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php
ConfigImporterMissingContentTest::setUp in core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php
DateFormatterTest::setUp in core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php
EntityKernelTestBase::setUp in core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
EntityRevisionTest::setUp in core/modules/migrate/tests/src/Kernel/Plugin/EntityRevisionTest.php

... See full list

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 689

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function installConfig($modules) {
  foreach ((array) $modules as $module) {
    if (!$this->container
      ->get('module_handler')
      ->moduleExists($module)) {
      throw new \LogicException("{$module} module is not enabled.");
    }
    $this->container
      ->get('config.installer')
      ->installDefaultConfig('module', $module);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.