Problem/Motivation
Discovered in #3361534: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate.
For example:
1) Drupal\Tests\big_pipe\Kernel\BigPipeInterfacePreviewThemeSuggestionsTest::testBigPipeThemeHookSuggestions
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for block.block.test_block1 with the following errors: 0 [dependencies.theme.0] Theme 'stark' is not installed.
Steps to reproduce
Run Drupal core's test suite with #3361534: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate applied, and with the lines
// @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$moduleMessage
// @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$themeMessage
// @todo Remove this in https://www.drupal.org/project/drupal/issues/3362456
"Module '.*' is not installed.",
"Theme '.*' is not installed.",
removed from \Drupal\Core\Config\Schema\SchemaCheckTrait::checkConfigSchema().
Proposed resolution
Solution for the example above:
tests/src/Kernel/BigPipeInterfacePreviewThemeSuggestionsTest.php
index 9064a6074a..1a06f675ec 100644
--- a/core/modules/big_pipe/tests/src/Kernel/BigPipeInterfacePreviewThemeSuggestionsTest.php
+++ b/core/modules/big_pipe/tests/src/Kernel/BigPipeInterfacePreviewThemeSuggestionsTest.php
@@ -51,6 +51,8 @@ protected function setUp(): void {
$this->blockViewBuilder = $this->container
->get('entity_type.manager')
->getViewBuilder('block');
+
+ $this->container->get('theme_installer')->install(['stark']);
}
/**
Remaining tasks
Fix all of these failures.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
Comments
Comment #2
wim leersComment #3
smustgrave commentedComment #4
chrisdarke commentedMigrating Pittsburgh 2023 to Pittsburgh2023 tag for cleanup
Comment #6
nickdickinsonwildeComment #8
nickdickinsonwildeAll test errors fixed. However, that has exposed some missing config schema in aggregator module. I believe updating that is out of the scope of this ticket but needs to be resolved before this ticket can land.
Comment #9
nickdickinsonwildeoh doh! Of course aggregator doesn't have config. Because Aggregator module was deprecated in core in 9.4 and removed in 10.0.
Will examine that migration test and see what options there are to work around that.
Comment #10
nickdickinsonwildeCR re aggregator: https://www.drupal.org/node/3267461
I think the best solution is to remove any tests related to migrating the aggregator module from core. but that might be beyond the scope of this issue still. So waiting for feedback/other ideas
Comment #11
borisson_No longer postponed, can be rerolled.
Comment #12
wim leersComment #13
borisson_This looks great, probably should be mentioned in the CR for #3362453: Fix all ConfigExists constraint violations in tests as well.
Comment #14
wim leersThere's one failure though 😅
Comment #15
wim leersSolved! 👍
Comment #16
smustgrave commentedMR appears to be unmergable.
Comment #17
wim leersThis conflicted with #3376794: `type: mapping` should use `ValidKeys: <infer>` constraint by default! Should be good again now :)
Comment #18
borisson_This looks great!
Comment #19
lauriiiPosted comment on the MR
Comment #20
wim leersDone.
Comment #21
wim leers#3372972: Fix all type: machine_name constraint violations in tests landed but didn't conflict with this. Still, merged in upstream changes to ensure accurate test results 👍
Comment #22
wim leersYay, #3362457: Fix all PluginExistsConstraint constraint violations in tests and #3377030: Add validation constraint to `type: label`: disallow multiple lines just landed — rebased! 👍
Comment #23
wim leersThis was RTBC'd in #18. It was only un-RTBC'd for A) a reroll, B) adding docs. https://git.drupalcode.org/project/drupal/-/merge_requests/4138/diffs?co... added docs, no functional changes.
So: restoring RTBC status.
Comment #26
lauriiiCommitted a9199ca and pushed to 11.x. Thanks!