\Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::testRequiredPropertyValuesMissing isn't compatible with typed properties

Created on 28 May 2025, 7 months ago

Problem/Motivation

\Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::testRequiredPropertyValuesMissing attempts to blindly set all required properties to NULL and assert a validation error.
But if the property being set is typed (i.e enforced at a language level) then setting it to NULL makes the test fail with a TypeError and no way to reuse the base class without overriding the whole method.

Steps to reproduce

Create a config entity with a typed property e.g.

protected string $something

Attempt to add validation tests using \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase
see testRequiredPropertyValuesMissing blow up with a TypeError

Proposed resolution

Catch TypeError and move on, validation is provided at the language level

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

configuration system

Created by

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • First commit to issue fork.
  • Merge request !12298Issue #3526908:... → (Open) created by annmarysruthy
  • Pipeline finished with Failed
    7 months ago
    Total: 134s
    #512175
  • Pipeline finished with Success
    7 months ago
    Total: 559s
    #512254
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Nice one @annmarysruthy - I think it in terms of adding a test, making one of the properties like weight on \Drupal\config_test\Entity\ConfigTest typed and adding a config validation test for that entity-type would demonstrate the issue.

  • Status changed to Needs work about 2 months ago
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 71s
    #655380
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1170s
    #655892
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1014s
    #655943
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 105s
    #655950
  • Pipeline finished with Failed
    about 2 months ago
    #655951
  • Pipeline finished with Failed
    about 2 months ago
    Total: 918s
    #655954
  • Pipeline finished with Failed
    about 2 months ago
    Total: 695s
    #655975
  • Pipeline finished with Canceled
    about 2 months ago
    #655986
  • Pipeline finished with Canceled
    about 2 months ago
    #656456
  • Pipeline finished with Failed
    about 2 months ago
    Total: 723s
    #656465
  • Pipeline finished with Success
    about 2 months ago
    Total: 1360s
    #656510
Production build 0.71.5 2024