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

Issue fork drupal-3362456

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

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes
Issue tags: +DrupalCon Pittsburgh 2023
smustgrave’s picture

Issue tags: -DrupalCon Pittsburgh 2023 +Pittsburgh 2023
chrisdarke’s picture

Issue tags: -Pittsburgh 2023 +Pittsburgh2023

Migrating Pittsburgh 2023 to Pittsburgh2023 tag for cleanup

NickDickinsonWilde made their first commit to this issue’s fork.

nickdickinsonwilde’s picture

Assigned: Unassigned » nickdickinsonwilde

nickdickinsonwilde’s picture

Assigned: nickdickinsonwilde » Unassigned

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

nickdickinsonwilde’s picture

Assigned: Unassigned » nickdickinsonwilde

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

nickdickinsonwilde’s picture

Assigned: nickdickinsonwilde » Unassigned

CR 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

borisson_’s picture

Title: [PP-1] Fix all ExtensionExistsConstraint constraint violations in tests » Fix all ExtensionExistsConstraint constraint violations in tests
Status: Postponed » Needs work

No longer postponed, can be rerolled.

wim leers’s picture

Status: Needs work » Needs review
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This looks great, probably should be mentioned in the CR for #3362453: Fix all ConfigExists constraint violations in tests as well.

wim leers’s picture

Status: Reviewed & tested by the community » Needs work

There's one failure though 😅

1) Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest::testBlockMigration
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'d6_block:visibility: The block with bid '13' from module 'block' will have no PHP or request_path visibility configuration.'
+'Schema errors for block.block.aggregator with the following errors: block.block.aggregator:settings.block_count missing schema, block.block.aggregator:settings.feed missing schema'
wim leers’s picture

Status: Needs work » Needs review

Solved! 👍

smustgrave’s picture

Status: Needs review » Needs work

MR appears to be unmergable.

wim leers’s picture

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This looks great!

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Posted comment on the MR

wim leers’s picture

Status: Needs work » Needs review

Done.

wim leers’s picture

#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 👍

wim leers’s picture

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

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

  • lauriii committed a9199caf on 11.x
    Issue #3362456 by NickDickinsonWilde, Wim Leers, borisson_: Fix all...

lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed a9199ca and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.