Stop using `first-uuid` and `second-uuid` in tests: violates config schema

Created on 31 May 2023, over 1 year ago
Updated 2 June 2023, over 1 year ago

Problem/Motivation

Discovered while working on 📌 KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed . See #3361534-29: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate .

Steps to reproduce

  1. Apply the changes to core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php that 📌 KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed makes.
  2. Run Layout Builder's tests
  3. You'll see failures like:
    
    Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest
    exception: [Other] Line 0 of sites/default/files/simpletest/phpunit-645.xml:
    PHPUnit Test failed to complete; Error: PHPUnit 9.6.7 by Sebastian Bergmann and contributors.
    
    Testing Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest
    ...EE....                                                           9 / 9 (100%)
    
    Time: 00:12.383, Memory: 4.00 MB
    
    There were 2 errors:
    
    1) Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testAccess with data set "view, disabled, data" (false, 'view', false, array(Drupal\layout_builder\Section Object (...)))
    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_view_display.entity_test.entity_test.default with the following errors: 0 [third_party_settings.layout_builder.sections.0.components.first-uuid.uuid] This is not a valid UUID.
    
    /var/www/html/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php:94
    /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111
    /var/www/html/core/lib/Drupal/Core/Config/Config.php:229
    /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:278
    /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php:486
    /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:257
    /var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php:339
    /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:609
    /var/www/html/core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php:101
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    
    2) Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::testAccess with data set "view, enabled, data" (true, 'view', true, array(Drupal\layout_builder\Section Object (...)))
    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_view_display.entity_test.entity_test.default with the following errors: 0 [third_party_settings.layout_builder.sections.0.components.first-uuid.uuid] This is not a valid UUID.
    

Proposed resolution

Simple solution for that too: replace first-uuid with 10000000-0000-0000-0000-000000000000, similar for the second one. But … turns out that UUID validation is strict by default, which imposes additional requirements … so had to go with 10000000-0000-1000-a000-000000000000 and 20000000-0000-1000-a000-00000000000 — which I think is equally simple. (And actually makes the tests clearer.)

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

🐛 Bug report
Status

Fixed

Version

10.1

Component
Layout builder 

Last updated 4 days 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