Problem/Motivation
Discovered in #3361534: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate.
For example:
1) Drupal\Tests\language\Functional\LanguageUILanguageNegotiationTest::testUrlLanguageFallback
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for block.block.site-branding with the following errors: 0 [id] The "site-branding" machine name is not valid.
and
1) Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for tour.tour.block-layout with the following errors: 0 [id] The <em class="placeholder">&quot;block-layout&quot;</em> machine name is not valid.
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 "machine_name" in core.data_types.schema.yml
// @todo Remove this in
"This machine name is not valid.",
removed from \Drupal\Core\Config\Schema\SchemaCheckTrait::checkConfigSchema().
Proposed resolution
Solution for the examples above:
diff --git a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
index 900b0c9dc4..e5e2bf0ca5 100644
--- a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
@@ -466,7 +466,7 @@ public function testUrlLanguageFallback() {
// Place a site branding block in the header region.
$this->drupalPlaceBlock('system_branding_block', [
'region' => 'header',
- 'id' => 'site-branding',
+ 'id' => 'site_branding',
]);
// Access the front page without specifying any valid URL language prefix
and
diff --git a/core/modules/tour/config/schema/tour.schema.yml b/core/modules/tour/config/schema/tour.schema.yml
index 05fcb5b058..7117f4b4ef 100644
--- a/core/modules/tour/config/schema/tour.schema.yml
+++ b/core/modules/tour/config/schema/tour.schema.yml
@@ -6,6 +6,9 @@ tour.tour.*:
mapping:
id:
type: machine_name
+ # Tour IDs also allow dashes.
+ constraints:
+ Regex: '/^[a-z0-9_-]+$/'
label: 'ID'
label:
type: label
(that's right, that's an oversight from #2920678: Add config validation for the allowed characters of machine names, and the same is true for the action config entity type, because these two A) barely have test coverage, B) have no UI, C) are not maintained!)
Remaining tasks
Fix all of these failures.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A




