Create unit test coverage for `ValidSlotNameConstraintValidator`

Created on 4 June 2025, about 1 month ago

Overview

๐Ÿ“Œ Constraint slot names allowed by XB in its component tree Active added ValidSlotNameConstraintValidator.

It added comprehensive test coverage in ComponentValidationTest::testSlotNameValidation(), where you'll see:

   * @testWith ["valid", false]
   *   ["even_more-valid", false]
   *   ["-", true]
   *   ["--", true]
   *   ["_", true]
   *   ["__", true]
   *   ["-not_valid", true]
   *   ["_not_valid", true]
   *   ["not_valid-", true]
   *   ["not_valid_", true]
   *   ["a", true]
   *   ["aa", true]
   *   ["aaa", false]
   *   ["n๐Ÿ˜ˆt_valid", true]
   *   ["spaces aren't okay", true]
   *   ["newline\nnot_allowed", true]
   *   ["rm -rf /", true]
   *   ["slot_\u03E2eird", true]

The problem: that takes ~2 minutes! Because it's a kernel test.

Proposed resolution

  1. Add unit test for ValidSlotNameConstraintValidator
  2. Remove all test cases except for one valid and one invalid from ComponentValidationTest::testSlotNameValidation()

User interface changes

None.

๐Ÿ“Œ Task
Status

Active

Version

0.0

Component

Config management

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @wim leers
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vinodhini.e chennai

    vinodhini.e โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom daniel.j

    daniel.j โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    11 days ago
    Total: 306s
    #532411
  • Pipeline finished with Failed
    11 days ago
    Total: 1181s
    #532414
  • Pipeline finished with Failed
    11 days ago
    #532433
  • Pipeline finished with Running
    11 days ago
    #532462
  • Pipeline finished with Failed
    11 days ago
    #532439
  • Pipeline finished with Failed
    11 days ago
    #532471
  • Pipeline finished with Failed
    11 days ago
    #532474
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom daniel.j

    I've removed all but two of the cases from the existing 'testSlotNameValidation' test and created the ValidSlotNameConstraintValidator. The tests are failing on this at the moment, but I indend to return to this in order to get the test to pass all green. I don't have much experience using stubs / mocks in this way, but am keen to get it working.

    If this is not testing for the right thing / in the right way, please let me know. Any feedback appreciated.

  • Pipeline finished with Failed
    11 days ago
    #532481
Production build 0.71.5 2024