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

Issue fork drupal-3530247

Command icon 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

joachim created an issue. See original summary.

joachim’s picture

Issue summary: View changes
joachim’s picture

Issue summary: View changes

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

joachim’s picture

Status: Active » Needs review

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.17 KB

The 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.

joachim’s picture

Status: Needs work » Needs review

Made 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.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The 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.

joachim’s picture

Status: Needs work » Needs review

Added support for config entities, and converted a test that uses one.

smustgrave’s picture

Neat could we get a CR for that?

joachim’s picture

Done.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Actually have no additional feedback, seems like a slam dunk win.