Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a subissue of #2012776: [META] Improve validation constraint test coverage
This is a test for the Constraint Validation: EntityChangedConstraintValidator
Beta phase evaluation
Issue category | Task because automated test | |
---|---|---|
Issue priority | Normal because this is focused on one area. | |
Unfrozen changes | Unfrozen because it only changes tests. Not a feature. |
Comment | File | Size | Author |
---|---|---|---|
#42 | drupal8-entitychanged-2142993-42.patch | 2.48 KB | stefan.r |
#39 | drupal8-entitychanged-2142993-39.patch | 13.07 KB | stefan.r |
Comments
Comment #1
mariancalinro CreditAttribution: mariancalinro commentedComment #2
stefan.r CreditAttribution: stefan.r commentedPostponed upon discussion with fago as the EntityChanged constraint validator will be reworked (or might disappear).
Comment #3
BerdirWhy that? it already has been reworked, from NodeChanged to EntityChanged?
Comment #4
stefan.r CreditAttribution: stefan.r commentedSee also #2145103: Provide non-configurable field types for entity created, changed and timestamp fields
Comment #5
jibranComment #6
mgiffordThis still a concern?
Comment #7
stefan.r CreditAttribution: stefan.r commentedComment #8
stefan.r CreditAttribution: stefan.r commentedComment #10
stefan.r CreditAttribution: stefan.r commentedFix for the failing node validation test as the property path is now
changed.0
instead ofchanged.0.value
due to the constraint inChangedItem
running on the field level.Comment #13
BerdirNice work.
Should have a leading backlash: \Drupal\...
We no longer use getInfo(). Add @group Validation to the annotation instead.
I think we should just add changed to the EntityTest entity type and use that. We have a large amount of entity types for specific tests already.
Comment #14
stefan.r CreditAttribution: stefan.r commentedComment #18
stefan.r CreditAttribution: stefan.r commentedFix attached for the other tests that were failing upon entity_test having a "changed" field.
As I looked at the failing REST update test, where the EntityChanged validation constraint was making it fail as the PATCH request was passing along a "changed time" situated in the past, I was wondering if there is any case where we want the end user to be able to forcibly/manually update the "changed" field to a date in the past? I guess we don't want the EntityChanged validator to run there in such case?
Comment #19
stefan.r CreditAttribution: stefan.r commentedComment #23
stefan.r CreditAttribution: stefan.r commentedre-roll
Comment #25
pfrenssenEntityChangedConstraintValidatorTest is missing from the reroll, this is the main part of the patch.
Comment #26
stefan.r CreditAttribution: stefan.r commentedComment #27
stefan.r CreditAttribution: stefan.r commentedComment #28
fagoThis will need to adapt once #2429037: Allow adding entity level constraints lands. It also introduces a separate test entity type which implements the EntityChangedInterface. Thus, we should be able to use it for testing here as well and so do away with the need for some other test changes as EntityTest remains unchanged?
Comment #31
stefan.r CreditAttribution: stefan.r commentedLooks like #2429037: Allow adding entity level constraints is almost in, let me do a re-roll in the mean time...
Comment #32
stefan.r CreditAttribution: stefan.r commentedreroll
Comment #34
stefan.r CreditAttribution: stefan.r commentedSeems we were sending an invalid changed time over REST without triggering a validation error before... So maybe the whole constraint currently isn't working?
This patch unsets the changed field in REST requests.
Comment #35
stefan.r CreditAttribution: stefan.r commentedComment #36
YesCT CreditAttribution: YesCT commentedOne of those is not hidden... so I think the test request should have gone.. but it did not.
#2420915-14: patches on issues not being sent to testbot for testing
re-uploading it so it goes to the bot.
Comment #38
stefan.r CreditAttribution: stefan.r commentedComment #39
stefan.r CreditAttribution: stefan.r commentedThanks. Here's a patch that should be green, for completeness. Just waiting to hear from @fago whether this issue ought to be closed as a duplicate of #2429037: Allow adding entity level constraints, as there's big overlap between both :)
Comment #40
fagoAs posted there, I think it still makes sense to add a dedicated test case. However, it will need a re-roll once #2429037 lands. As the other one is critical, let's postpone this on it.
Comment #41
YesCT CreditAttribution: YesCT commented#2429037: Allow adding entity level constraints went in. unpostponing so the work can start on the reroll.
@stefan.r also, the beta evaluation needs some changes which I think you will see since we worked on the beta evaluation in the other issue.
Comment #42
stefan.r CreditAttribution: stefan.r commentedReroll, this runs the validator on the entity instead of on the field.
It also removes the field-level validation, the fix to the validator itself as well as the added changed field to entity_test entity type (as we now have 'entity_test_constraints'). So all that is left is the test anymore :)
Comment #43
stefan.r CreditAttribution: stefan.r commentedComment #44
stefan.r CreditAttribution: stefan.r commentedAfter this patch we only need #2142995: PrimitiveTypeConstraintValidator does not validate some values correctly anymore to have complete test coverage for #2012776: [META] Improve validation constraint test coverage.
In #2142995: PrimitiveTypeConstraintValidator does not validate some values correctly I could use some help on why this last test fails as I am not sure on why some of the primitive type constraints are validated the way they are.
Comment #58
smustgrave CreditAttribution: smustgrave at Mobomo commentedNeeds to be updated for 10.1
See some deprecated calls in the patch.
Comment #59
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis still a concern?
Comment #61
smustgrave CreditAttribution: smustgrave at Mobomo commentedSince there hasn't been movement or a follow up in 8 years going to close for now.
If still valid task please reopen.