Problem/Motivation
KernelTestBase::installConfig() installs all of the config for the specified modules. In a lot of cases, that is more than you need. This means that test modules which provide config need to be split up into smaller modules which adds to boilerplate and noise.
Some modules such as Views have already invented their own approach for this -- see \Drupal\views\Tests\ViewTestData::createTestViews(). This issue would allow these different systems to be converted to a common approach as follow-ups issues. It would also make it easier to develop views for tests, as Config Devel module could be used to edit them in the admin UI.
Proposed resolution
Add a helper method to KernelTestBase which installs specific config items from a given module.
E.g.
$this->installSpecificConfig($module, [$config1, $config2]);
Remaining tasks
There is already code to do this in Config Devel module, which will be made simpler when #3123491: make it easier to instantiate ConfigImporter gets in.
User interface changes
Introduced terminology
API changes
New method in KTB.
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3530247
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joachim commentedComment #3
joachim commentedComment #5
joachim commentedComment #7
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #8
joachim commentedMade a proof of concept.
Doesn't yet support config entities -- that should come next.
Also, needs review from people who understand the innards of the config system, as I don't know what any of the storage / collection stuff means.
Comment #9
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #10
joachim commentedAdded support for config entities, and converted a test that uses one.
Comment #11
smustgrave commentedNeat could we get a CR for that?
Comment #12
joachim commentedDone.
Comment #13
smustgrave commentedActually have no additional feedback, seems like a slam dunk win.