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.
Comment | File | Size | Author |
---|---|---|---|
#21 | 2972808-21.patch | 26.85 KB | Wim Leers |
| |||
#21 | interdiff.txt | 968 bytes | Wim Leers |
#18 | 2972808-18.patch | 25.76 KB | gabesullice |
#18 | interdiff-16-18.txt | 7.05 KB | gabesullice |
#17 | 2972808-16.patch | 25.66 KB | gabesullice |
|
Comments
Comment #2
gabesulliceComment #3
Wim Leers#2953321: Comprehensive JSON API integration test coverage phase 5: nested includes and sparse field sets just landed, which means this is the only remaining bit! 🎉
Comment #4
gabesulliceI'm still working on this, but here's the progress.
Comment #5
Wim LeersÜbernit: that's a lot of parentheses!
Hm, I suspect the code in HEAD is incorrect, and you needed to change it? (But without consequences in HEAD, which is why HEAD's passing tests just fine?)
+1 — this improves testing/debugging DX. We have something very similar for cache tags/contexts headers test assertions :)
Why?
Why not create
testPostRelationships()
etc?Nice todo list!
Comment #6
gabesullice1. ✅
2. Yeah. This current code is a valid field configuration for an ER field to a bundle-able entity type, but it's not what would actually be created for a
User
ER field AFAICT. This change is what prompted #2976371: Impossible to POST|PATCH relationship to bundle-less entity or entity reference field without target bundles and that's why it's not broken in HEAD.3. Glad you like it. It seems I change this in every round of testing, but it keeps getting more helpful (I hope).
4. To keep the number of tests (read, time) down. See
doTestRelationships(Get|Post)
for the separated versions.5 :)
Comment #7
gabesulliceThis should fix some of the errors.
Comment #8
gabesulliceMany of these errors are related to #2956084: Impossible to raise an error when an `include` is requested for an inaccessible relationship field.... I _can't wait_ for that :)
Comment #9
gabesulliceThis should get the remaining fails. Now to start on that todo list!
Comment #10
gabesulliceWell... I started on that list only to find these new errors... bummer. Anyway, easy fix.
Comment #11
gabesulliceGetting some of the todos set up, most need follow up issues.
Comment #12
Wim LeersThese are nearly identical… this is very confusing! 😵 I think one is intended for updating, the other for creating?
PATCH
ing relationships is not yet tested?These are still intended to happen in this issue, I think?
Why this change?
Why this change?
Comment #13
gabesullice#12.1: Yes, something like that, it was very confusing! I'm not even sure it's necessary to have these defined at all, I might just be able to add them in the test, in which case I'll put comments there.
12.2: Correct, and that will be done in this issue
12.3: Correct, see attached!
12.4/5: Because PATCHing a relationship triggers validation of the entity. A shortcut uri field has a validation contraint that it be accessible by the user, and a user email field has a validation constraint that the email be unique. Surprisingly, this didn't come up before because we were saving these entities from within the test container without calling
validate
first.Comment #14
gabesulliceNote that I did not end up writing a test for this. I think it would require unnecessary work to get set up.
Comment #15
Wim LeersJust FYI: #13's interdiff looks great :)
This is not just missing a field, this is missing essential information. Updating the comment is sufficient.
Übernit: not yet unindented :)
Comment #16
gabesullice#15.1: done
15.2. fixed
This adds PATCH+DELETE coverage.
CS patch to follow along w/ any unexpected failures.
Comment #17
gabesullice😩
Comment #18
gabesulliceCS fixes.
Comment #19
gabesullice😅whew. done for now :)
Comment #21
Wim LeersEPIC EPIC EPIC work!
I'm 99% certain Gabe only meant to remove the extraneous slashes on line 1447, but in doing so, PHPStorm helpfully also uncommented lines 1448 and 1449. All failures are on line 1448.
So, reverting this.
Comment #22
Wim LeersSo, review time!
My review in #12:
Issues discovered here (yay for test coverage to find places where things were not quite working the right way!):
The last of those three is already fixed, and already shipped with the 1.19 release!
Issues not discovered here, but related: #2956084: Impossible to raise an error when an `include` is requested for an inaccessible relationship field.. In #8, @gabesullice said that issue would solve problems encountered in this issue. I took it as meaning that #2956084 was a blocker for this issue, but obviously it isn't.
Re-review of the patch:
Woah! This makes sense, but I had to think it through. Idempotency means this must indeed be a 204 response.
This is great, but I have one question/reservation: we're never testing the deleting of a specific arity.
What if the first quoted line would create three relationships instead of two, we'd then delete the "middle" one by specifying the appropriate arity, verify this in the response, and then delete without specifying an arity, which should result in no relationships being left?
Perhaps this is something that is up to #2977659: Spec Compliance: POST|PATCH|DELETE on relationships should respect arity rules to add?
That second point is the only remaining question I have! After it's answered/addressed, this is RTBC :)
Comment #23
gabesullice🙏❤️
You're correct that we can't test it until #2977659: Spec Compliance: POST|PATCH|DELETE on relationships should respect arity rules lands. BUT, there is coverage that just needs to be uncommented:
I don't think it's necessary to test with 3 relationships and verify 2 remaining, since arity is not a stored value, it is a calculated one.
IOW, there's no difference in final result if I delete the 0th, 1st or 2nd arity item—I'll always end up with [{id: A, arity: 0}, {id: A, arity: 1}] in the end.
That's is in there too :)
I think I've thoroughly addressed it, so moving to RTBC!
Comment #24
Wim Leers🙈 OMG! 😳
That's what I looked for, but I only looked further down in the patch rather than up. Which doesn't even make sense. If I'd seen that, I'd have committed it already.
Right again; I misremembered
arity
for its original implementation (synonym for Drupal'sdelta
), but obviously that's not what it is.Yep, that's the portion that's already being run/tested :)
RTBC confirmed, committing…
Comment #26
Wim Leers🍻
Comment #27
gabesullice🎊🤘