Fix all ExtensionExistsConstraint constraint violations in tests

Created on 24 May 2023, over 1 year ago
Updated 1 August 2023, over 1 year ago

Problem/Motivation

Discovered in 📌 KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed .

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 📌 KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed 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

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Configuration 

Last updated about 22 hours ago

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024