I am using the Configuration Sync module to export config specific to my site out into a config directory that lives outside my main Drupal directory.

When writing kernel tests I know that you can use $this->installConfig() and specify a module(s) to install default config from, but how can I specify certain (or all) config files from that directory to be installed inside of a kernel test?

1 Answer 1


If you need to install some separately, determine which you would like to install together and place them in a new module together. Then you can install different combinations by specifying which modules to install.

  • I agree that is definitely a way, but that seems contrary to how the config export works. It already gives me a directory full of config files. I feel I should be able to use something `$this->installConfig('config_sync') to install them during a test. Dec 17, 2021 at 11:06
  • That’s like saying that you should be able to install a module, but specify which entities are installed, or which blocks. A module is a self contained collection of code that implements a feature. If you need only one part of that, then it is a dependency and should get split off into a separate module. Dec 18, 2021 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.