Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
content_moderation.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2017 at 05:56 UTC
Updated:
2 Feb 2018 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
berdirI assume this will be quite different to other tests.
A moderation state is not a standalone thing, it is closely tied to an actual entity that is being moderated. So the tests here will likely be very specific to it, to make sure that changing a moderation state does the thing it needs to to its moderated entity.
Another thing is validation and access logic. Of the moderation state itself, I'm not sure how much support we have for that already (e.g. that only some users can move to published and only some changes are allowed and so on) but also that you can directly change the status of a node anymore. #2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button will likely add hook_entity_field_access() to enforce that.
Comment #4
wim leersComment #5
HeyLodyM commentedComment #6
wim leersThanks, HeyLodyM!
Comment #7
wim leersComment #8
HeyLodyM commentedTo accomplish this task, I wanted to test a validated issue but I was stuck on this error:
If someone has an idea?
Comment #9
wim leers#2843774-6: EntityResource: Provide comprehensive test coverage for BlockContentType entity reported the same problem. I have no idea how that is possible — I can't reproduce this (see #2843774-8: EntityResource: Provide comprehensive test coverage for BlockContentType entity).
Comment #10
sam152 commentedClosing as agreed in #2779931: Add storage exception that enforces unique content_entity_type_id and content_entity_id on the content moderation state content entity, and add access control handler to forbid all access. There is an access control handler that denies access to the entity.
Comment #11
wim leersI was just coming here to do exactly that! Thanks, @Sam152 :)
Comment #12
wim leersUpdated #2824572 accordingly: #2824572-31: Write EntityResourceTestBase subclasses for every other entity type..
Comment #13
wim leersActually, based on what I've just been doing in #2835767: Media + REST: comprehensive test coverage for Media + MediaType entity types, I think a similar approach is warranted here.
content_moderation_stateentities, including viewing.entity:content_moderation_statederivative REST resource plugin still exists!… yet it won't work because of point 1.
The solution is simple: we remove the
entity:content_moderation_statederivative REST resource plugin — which is exactly what #2835767: Media + REST: comprehensive test coverage for Media + MediaType entity types does for the Media module's entities.Comment #14
wim leersComment #17
wim leersSmall naming problem.
Comment #18
amateescu commentedWhy is this a Browser test? As far as I see it doesn't interact with any page, so it can simply be a kernel test?
Edit: and there's still a small naming problem: ContentModerationStateResourceTest
Comment #19
wim leersWell spotted! I only noticed it because testbot complained. Already fixed in #18 :)
Great point, done!
Comment #20
wim leersOh, perhaps you meant that it should be renamed from
ModerationStateResourceTesttoContentModerationStateResourceTest? Happy to do that. I named it like that because almost everything else is calledModerationState*Test.php. Perhaps the reasoning is just not clear to me.Let me know, happy to reroll.
Comment #21
amateescu commented@Wim Leers, I think the name of the test class should be
ContentModerationStateResourceTestbecause it tests theContentModerationStateentity type :)Comment #23
wim leersFair!
Comment #24
wim leersComment #25
amateescu commentedLooks good to me now :)
Comment #26
larowlannit:not sure the word 'also' is needed here (can be fixed on commit)
Comment #27
plach@Wim Leers and @xjm suggested to add this as a MUST-HAVE for the Workflow Initiative.
Comment #28
plach[removed]
Comment #29
larowlanUpdating issue credit to add @amateescu who helped shape patch
Can we get an issue summary update as the proposed resolution isn't where the patch ended up.
Comment #30
sam152 commentedComment #32
larowlanThanks @Sam152 for updating issue summary
Fixed on commit
Committed as 930a35b and pushed to 8.4.x. On with the next WI critical!
Comment #34
wim leersWe're keeping this test, but the work-around introduced here is now being removed in #2941622: Make REST's EntityResource deriver exclude internal entity types and mark ContentModerationState entity type as internal instead of the current hack because we now have a proper API for this!