protected function KernelTestBase::installConfig in Drupal 8
Same name in this branch
- 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::installConfig()
- 8 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.
3 calls to KernelTestBase::installConfig()
- EntityUnitTestBase::setUp in core/
modules/ system/ src/ Tests/ Entity/ EntityUnitTestBase.php - Performs setup tasks before each individual test method is run.
- KernelTestBaseTest::testInstallConfig in core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php - Tests expected behavior of installConfig().
- ViewKernelTestBase::setUpFixtures in core/
modules/ views/ src/ Tests/ ViewKernelTestBase.php - Sets up the configuration and schema of views and views_test_data modules.
File
- core/
modules/ simpletest/ src/ KernelTestBase.php, line 436
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\simpletestCode
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),
]));
}