Implement NoEntitiesExistYetWithHigherCardinality tests

Created on 14 March 2025, 6 months ago

Problem/Motivation

In the parent issue NoEntitiesExistYetWithHigherCardinality was implemented. But it needs tests. Lets do that here.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component

field system

Created by

🇳🇱Netherlands bbrala Netherlands

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

Merge Requests

Comments & Activities

  • Issue created by @bbrala
  • 🇳🇱Netherlands bbrala Netherlands

    Added the changes from the parent, lets get some working tests.

  • Pipeline finished with Failed
    6 months ago
    Total: 155s
    #448508
  • First commit to issue fork.
  • Pipeline finished with Failed
    6 months ago
    Total: 153s
    #454984
  • Pipeline finished with Failed
    6 months ago
    Total: 156s
    #454990
  • Pipeline finished with Failed
    6 months ago
    Total: 268s
    #454991
  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇳🇱Netherlands bbrala Netherlands

    I did a bugfix for the validator in the parent issue: https://git.drupalcode.org/project/drupal/-/merge_requests/3047/diffs?co...

    That change is needed here also.

  • Pipeline finished with Failed
    6 months ago
    Total: 199s
    #455790
  • Pipeline finished with Failed
    6 months ago
    Total: 674s
    #455795
  • Pipeline finished with Failed
    6 months ago
    Total: 152s
    #458717
  • Pipeline finished with Failed
    6 months ago
    Total: 504s
    #458777
  • Pipeline finished with Failed
    6 months ago
    Total: 297s
    #459693
  • Pipeline finished with Failed
    6 months ago
    Total: 134s
    #459695
  • 🇳🇱Netherlands bbrala Netherlands
  • Pipeline finished with Success
    6 months ago
    Total: 3365s
    #459699
  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    I have some small documentation remarks, but this looks great.

  • Pipeline finished with Failed
    6 months ago
    Total: 153s
    #459911
  • 🇳🇱Netherlands bbrala Netherlands

    Updated the comments. :)

  • 🇳🇱Netherlands bbrala Netherlands
  • Pipeline finished with Success
    6 months ago
    #459913
  • 🇺🇸United States smustgrave

    This should probably have a CR right?

  • 🇳🇱Netherlands bbrala Netherlands

    Yeah cr, is, and title updtae. Since this basically is the implementation of this constraint.

  • 🇳🇱Netherlands bbrala Netherlands
  • 🇳🇱Netherlands bbrala Netherlands

    Title updated.

    I looked at other issues regarding validation, and when there is no change in the interface (like '' becoming NULL) it seems it is not needed to have a CR as far as i can see.

  • 🇺🇸United States smustgrave

    Right but maybe we should.

    Just to announce the new validation type that contrib modules can now use.

  • 🇳🇱Netherlands bbrala Netherlands

    Ok, added a cr

  • 🇺🇸United States smustgrave

    Added to the top of my list for tomorrow!

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    I reviewed the CR. It has all the information needed.

  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇳🇱Netherlands bbrala Netherlands
  • Pipeline finished with Success
    5 months ago
    Total: 655s
    #463358
  • Pipeline finished with Success
    5 months ago
    Total: 767s
    #467580
  • 🇳🇿New Zealand quietone

    There are no unanswered questions. I read the MR where I found the comments helpful and clear. And the CR is good to go as well. I updated credit.

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

    I'm confused about the scope here - the parent issues says 📌 Convert field_storage_config and field_config's form validation logic to validation constraints Needs work

    I've split two issues for the missing tests.

    And links to this issue.

    But this issue adds the constraint and no tests?

    The needs tests tag was added in #3 but then removed later without any discussion I can see (apologies if I've missed something obvious).

    We're adding the constraint to the schema too, so should we be adding some tests? Should we be removing something else?

    I'm curious about the use of NULL in the call to ->aggregate - it would be good to see some tests confirming that this indeed checks all langcodes for instances where the existing delta is higher.

  • 🇳🇱Netherlands bbrala Netherlands

    In the parent issue there were indeed 2 constraints that needed tests, and since these validation issues have been broken down a lot, i opted to create 2 issues for those contraints. But to test, you need the contraint also so it is implemented here.

    Now sure what test you are missing, isnt NoEntitiesExistYetWithHigherCardinalityTest a test for this contraint? Seems reasonable to test like that. If you recon that is not enough coverage please let me know what you want more.

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

    I don't see any tests for the validator class, only for the constraint

  • 🇳🇱Netherlands bbrala Netherlands

    Confused, the validation runs against the constraint, i try to make cases for the constraint that touch the different paths throuugh the constraint.

  • Status changed to Needs review 2 months ago
  • 🇺🇸United States smustgrave

    @larowlan thoughts on the last comment?

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

    I don't see any tests that call ::validate and ensure the constraint validator works

  • Pipeline finished with Canceled
    6 days ago
    Total: 69s
    #591049
  • 🇳🇱Netherlands bbrala Netherlands

    Wow just wow, i think i mixed code because there was indeed no test.

    Created a test that validates, and also updated the logic.

    delta == count -1, which was not added, so it worked, but only after having 2 extra for the cardinality!

    Also rebased.

  • Pipeline finished with Failed
    6 days ago
    Total: 162s
    #591051
  • Pipeline finished with Failed
    6 days ago
    Total: 166s
    #591055
  • Pipeline finished with Failed
    6 days ago
    Total: 166s
    #591063
  • 🇳🇱Netherlands bbrala Netherlands

    Needs some small fixes in test names and such ot seems.

  • Pipeline finished with Failed
    6 days ago
    Total: 1134s
    #591066
  • Pipeline finished with Failed
    6 days ago
    Total: 609s
    #591134
  • Pipeline finished with Canceled
    5 days ago
    #591618
  • Pipeline finished with Failed
    5 days ago
    Total: 960s
    #591621
  • Pipeline finished with Failed
    5 days ago
    Total: 1489s
    #591645
  • Pipeline finished with Success
    5 days ago
    Total: 550s
    #591658
  • 🇳🇱Netherlands bbrala Netherlands

    Directory name Contraint vs Constraint. I keep making that typo... ;x

  • Status changed to RTBC 2 days ago
  • 🇺🇸United States smustgrave

    Appears feedback around the ::validate is covered in core/modules/field/tests/src/Kernel/Plugin/Validation/Constraint/NoEntitiesExistYetWithHigherCardinalityTest.php now which checks the exception message.

    Believe all feedback has been addressed

Production build 0.71.5 2024