- Merge request !2717Issue #3307247: Convert static functions in Content moderation state Entity class to Service for easier Unit testing β (Open) created by murz
- πΊπΈUnited States smustgrave
Sorry didn't mean for this to fall of my radar.
Removing the needs tests tag as I can see they were added
Appears there are failures that need to be fixed.
Thanks! Will keep an eye out in my email for this to come back around.
- Status changed to Needs review
about 2 years ago 10:16am 30 January 2023 - π¦π²Armenia murz Yerevan, Armenia
I've fixed the tests, @smustgrave - please take a look!
- Status changed to Needs work
about 2 years ago 2:57pm 30 January 2023 - πΊπΈUnited States smustgrave
Pinged @Sam152 as the content moderation subsystem maintainer.
Left a few comments for typehints.
Tagged for a change record for the new service.Everything else looks good
Thanks!
- π²π©Moldova andrei.vesterli Chisinau
Hi @Murz
I've also left a few comments. Take a look at them if you don't mind. Nice job man.
Regards,
Andrei - π¦π²Armenia murz Yerevan, Armenia
@andrei.vesterli, @smustgrave I've made fixes by all remarks, please take a look!
I have a question about how the types should be exact in the function:
public function loadFromModeratedEntity(EntityInterface&RevisionableInterface $entity): ?ContentModerationStateInterface {
While Intersection is still not supported by phpcs (https://github.com/squizlabs/PHP_CodeSniffer/issues/2410) - is it ok to leave this as Union like
EntityInterface&RevisionableInterface $entity
, or it's better to keep just theEntityInterface $entity
there?The
RevisionableInterface
interface is required for this line:->condition('content_entity_revision_id', $entity->getLoadedRevisionId())
- Status changed to Needs review
almost 2 years ago 5:54am 8 February 2023 - Status changed to Needs work
almost 2 years ago 4:51pm 11 February 2023 - πΊπΈUnited States smustgrave
Still needs a change record I believe.
- Status changed to Needs review
almost 2 years ago 3:37pm 12 February 2023 - π¦π²Armenia murz Yerevan, Armenia
I've created a change record here https://www.drupal.org/node/3341126 β - please take a look. Do I need to add or rework something there?
- πΊπΈUnited States smustgrave
Nope that CR looks good to me. Going to ping Sam152 for subsystem review
- π¦πΊAustralia Sam152
Personally I would avoid adding deprecations, disrupting existing code and introducing a new public service in place of APIs marked
@internal
, to satisfy testing requirements outside of core. Custom code always has the option of adding a new interface that thinly wrap this functionality. - π¦πΊAustralia Sam152
More subjectively I don't think the example given is a great candidate for a unit either, the body of the function itself doesn't contain a lot of complex branches. There is a higher risk that the configuration may change in a some unexpected way, the
ContentModerationState
entity being MIA or the entity being passed in not being under moderation for whatever reason etc.protected function getModerationStatusLabel(EntityInterface $entity) { return \Drupal\content_moderation\Entity\ContentModerationState::loadFromModeratedEntity($entity) ->workflow ->entity ->get('type_settings')['states'][$entity->moderation_state->value]['label']; }
Don't take it personally though, in my experience Drupal projects are generally not unit testable. Most failure and risk comes from bootstrapping complex structures and behaviours out of the database, plugging-in and alter-ing as a design pattern, on top of a core product and suite of modules that are evolving underneath you. You sort of have to boot the whole thing up before you can be confident anything is actually working :)
- π¦πΊAustralia Sam152
Removing the tag. I'm more than fine with not having the final say on this one, if someone else feels strongly about pushing it forward.
- π¦π²Armenia murz Yerevan, Armenia
On the next self-review I've found the way to simplify the things without creating a new service, so I've moved the
loadFromModeratedEntity()
to thecontent_moderation.moderation_information
service.
Also get rid of deprecated function call in all related unit tests. - πΊπΈUnited States smustgrave
So this is a complex one that I can't fully speak to. From the changes I've seen I give it +1 for RTBC will see if someone else will review.
- Status changed to Needs work
almost 2 years ago 9:17pm 13 February 2023 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- Status changed to Needs review
almost 2 years ago 7:07am 14 February 2023 - π¦π²Armenia murz Yerevan, Armenia
The original function in the Core was changed by #2860097: Ensure that content translations can be moderated independently β , so I've squashed commits and rebased on the fresh Core branch.
- Status changed to RTBC
almost 2 years ago 10:24pm 16 February 2023 - πΊπΈUnited States smustgrave
Will send to committers for their thoughts.
- Status changed to Needs work
almost 2 years ago 3:17pm 12 April 2023 - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,387 pass, 1 fail - last update
over 1 year ago 29,388 pass - Status changed to Needs review
over 1 year ago 1:46pm 13 May 2023 - π¦π²Armenia murz Yerevan, Armenia
Corrected everything according to the comments, please review.
- Status changed to Needs work
over 1 year ago 7:07pm 17 May 2023 - last update
over 1 year ago 29,653 pass - Status changed to Needs review
over 1 year ago 1:54pm 3 October 2023 - π¦π²Armenia murz Yerevan, Armenia
Thank you for the review, committed fixes for all remarks, please review.
- Status changed to Needs work
over 1 year ago 5:37pm 3 October 2023 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch 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.
- Open on Drupal.org βEnvironment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - Issue was unassigned.
- Status changed to Needs review
over 1 year ago 5:04am 4 October 2023 - Status changed to Needs work
over 1 year ago 12:29pm 4 October 2023 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch 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.
51:18 50:13 Running- last update
over 1 year ago 30,375 pass, 2 fail - last update
over 1 year ago 30,379 pass - Status changed to Needs review
over 1 year ago 10:19am 5 October 2023 - last update
over 1 year ago 30,377 pass - Status changed to RTBC
over 1 year ago 7:14pm 5 October 2023 - πΊπΈUnited States smustgrave
Made a very minor tweak changing 10.1.0 to 10.2.0, don't think that should exclude me from marking.
Checking 2717 though and appears all feedback from previous reviews have been addressed.
- last update
over 1 year ago 30,382 pass - last update
over 1 year ago 30,384 pass - last update
over 1 year ago 30,392 pass, 1 fail - last update
over 1 year ago 30,397 pass - last update
over 1 year ago 30,410 pass - last update
over 1 year ago 30,415 pass - last update
over 1 year ago 30,420 pass - last update
over 1 year ago 30,426 pass - last update
over 1 year ago 30,434 pass - last update
over 1 year ago 30,438 pass - last update
over 1 year ago 30,456 pass - last update
over 1 year ago 30,472 pass - last update
over 1 year ago 30,483 pass - last update
over 1 year ago 30,485 pass - last update
over 1 year ago 30,486 pass - last update
about 1 year ago 30,488 pass - last update
about 1 year ago 30,511 pass - last update
about 1 year ago Build Successful - last update
about 1 year ago 30,530 pass - last update
about 1 year ago 30,552 pass - last update
about 1 year ago 30,574 pass - last update
about 1 year ago 30,603 pass - last update
about 1 year ago 30,605 pass - last update
about 1 year ago 30,667 pass - last update
about 1 year ago 30,675 pass - last update
about 1 year ago 30,679 pass 29:36 25:48 Running- last update
about 1 year ago 30,688 pass - last update
about 1 year ago 30,688 pass - last update
about 1 year ago 30,688 pass - last update
about 1 year ago 30,696 pass - last update
about 1 year ago 30,698 pass - Status changed to Needs work
about 1 year ago 12:33am 11 December 2023 - π¬π§United Kingdom alexpott πͺπΊπ
There are some comments on the MR to be resolved.