Closed (fixed)
Project:
JSON:API
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Mar 2019 at 01:07 UTC
Updated:
22 Mar 2019 at 23:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gabesulliceComment #3
gabesulliceComment #4
wim leers🔍🐛 Übernit: I don't see why we're changing this. Can easily be reverted on commit though.
✅ This is functionally identical to the code I wrote nearly two years ago in #2838395-27: [PP-1] Entity API bug affecting REST: "last changed" timestamp not updated and "create new revision" setting not respected when PATCHing via REST. Looks good :)
✅
block_content.type.basic.ymlalso hasrevision: 0, and we're already ensuring the correct expected behavior forNode, no need to do it for multiple entity types. Works for me. 👍👏 Great, we're testing this for
Node, where this is most expected to work.✅ We now have to bypass the test runner's static entity cache, to ensure we fetch the latest revision of the just-
PATCHed entity. 👍✅ And we then verify the current revision ID is greater than the prior.
✅ Ah,
\Drupal\Core\Entity\ContentEntityStorageBasehas a$this->latestRevisionIdsstatic cache, which without this::resetCache()call would result in the test assertions being unable to correctly assert that a revision is indeed the latest revision. Static caches strike again!Comment #5
plachShouldn't this happen only when we create a new revision? I.e. we should add an
::isNewRevision()call. This would also take care of new entities.Why do we need this?
::loadUnchanged()will always load data from the storage.Comment #6
wim leersresetCache()you'll see that the test fails.Comment #7
wim leersTest coverage for #6.1.
Comment #8
plachLooks good to me, if green!
Comment #10
wim leersFor #6.2, @plach just opened #3038706: Clean up ::entityLoadUnchanged in ResourceTestBase. Adding a
@todoto point to that, so we can get rid of that in the future.Comment #12
wim leers