Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
comment.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Jun 2016 at 03:43 UTC
Updated:
27 May 2021 at 15:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
naveenvalechaCross posting the patch from #2526060-4: Add tests for action plugins
Comment #5
mradcliffeThis patch needs some work and probably needs a re-roll. The details for how to do so can be found in the parent issue linked in the issue summary.
Comment #6
johanv commentedI will write a summary for this issue. See https://www.drupal.org/contributor-tasks/write-issue-summary.
Comment #7
eyal shalevWorking on this during the Dublin sprints
Comment #8
wizonesolutionsWorking on this with Eyal Shalev
Comment #9
johanv commentedComment #10
eyal shalevhttps://gist.github.com/anonymous/562aae1d43fff43ba59f7c78c0639070
Comment #11
johanv commentedWe fixed the naming issue, and we provided a name for the test user. Here is a new patch.
Comment #12
johanv commentedComment #13
wizonesolutions@johanv and @Eyal Shalev worked on this patch together.
Comment #14
eyal shalev.
Comment #16
johanv commentedWe (wizonesolutions, Eyal Shalev and me) split up the test into 5 tests. We tested it locally, and it still works.
Comment #17
mmrares commented@file isn't required.
Missing full stop.
Missing parameter comment.
Description for return value is missing and separate @param and @return sections by a blank line.
Check the type of @return value
An empty line before class end.
Comment #18
mmrares commentedTests ran successfully on local environment.
Comment #19
wizonesolutionsHere is the revised patch. No logic changes, so if the tests in #16 pass, and this is otherwise good, I think we should RTBC this :)
Comment #20
johanv commentedYou uploaded an empty patch :-)
Comment #21
wizonesolutionsComment #22
wizonesolutionsComment #23
johanv commentedComment #24
johanv commentedI have to leave now. I reviewed the latest patch, it handles the comments of mmrares. So if the test bot does not find any problems, I think this is RTBC.
Comment #25
wizonesolutionsFixed file comment.
Comment #26
condor616 commentedI confirm that issues from #17 are resolved in the patch #25
There are no logic changes and test in #16 passed so this will still pass
Comment #27
mradcliffe@wizonesolutions, @johanv. One thing that helps when creating new patches is to create an interdiff so that we can see the specific changes between patches. See https://www.drupal.org/documentation/git/interdiff
Comment #28
wizonesolutionsFixing inconsistent whitespace and ensuring test method docblocks start with a third-person verb per IRC comment by @YesCT.
No code changes, so tests will still pass.
@condor616 reviewed this live as I wrote it.
Comment #29
mile23Just a nit here, not enough to un-rtbc.
All usages of
\Drupalshould be $this->container.Comment #32
erozqba commentedApplying the changes suggested by Mile23
Comment #33
mradcliffeThe interdiff is the reverse. Interdiffs are created in format:
interdiff <previous patch> <next patch>.I reviewed the patch manually and
\Drupal::is indeed removed in favor of$this->container->get.Comment #35
erozqba commentedSubmit a new patch to be tested against 8.4.x and with a fixed interdiff.
Comment #37
erozqba commentedThe last submitted patch, 35: 2742997-35.patch, pass testing.
Comment #38
naveenvalechaHow about the test in this namespace?
Comment #41
borisson_The new test looks good and it seems to be in the correct namespace.
Comment #42
alexpottIt's a kernel test not a unit test.
Comment #43
alexpottThis should assert the comment is new before executing the action.
This should assert the comment is published after saving.
This needs to assert the comment is not published after saving.
This needs to assert that the comment is published after saving.
This needs to test that the comment is published before triggering the action. Also I'd expect a test to ensure the is the comment doesn't contain the keyword this action doesn't unpublish the comment. Plus what is the difference between testCommentUnPublishByKeywordAction and testUnpublishByKeywordAction?
Comment #45
MerryHamster commentedReroll patch from #38 for 8.7.x
Still, need to add all notices from #43
Comment #46
MerryHamster commentedComment #48
MerryHamster commentedReroll patch from #38 for 8.7.x
Still, need to add all notices from #43
Comment #49
MerryHamster commentedComment #52
vacho commentedAdding proposal in #43 to patch.
Comment #53
andypostThis test needs clean-up because save/delete/publish/unpublish actions already tested because they are now core ones.
Moreover module's actions are deprecated except
\Drupal\comment\Plugin\Action\UnpublishByKeywordCommentoneAlso there's already functional test which better to convert to kernel one based on patch here
Comment #54
andypostConverted, changed test to test the only action and all ones shipped by default configured
The functional test us removed
Comment #55
andypostActions to save/delete use own tests, the same as [un]publish are using only kernel tests
Comment #56
larowlanWe have a method on UserCreationTrait for this now
any reason to make this a class property? can't we just use inline variables in the second method?
Comment #57
andypostFixed #56.1 using trait from parent class
About #56.2 test needs this keywords in setup (create comment with keywords) and test method
Comment #58
andypostComment #59
krzysztof domańskiComment #61
tvb commentedPatch could not be applied cleanly to 8.9.x-dev.
Rerolled patch 2742997-58.patch.
It was not an auto merge. See diff of two most recent patches for details: reroll_diff_58-61.txt.
Comment #64
daffie commentedComment #65
andypostRerolled
Comment #66
daffie commentedThe patch looks good. Just one minor request:
Can we add an assertion that
This->commenthas been deleted.Comment #67
andypostThere's no actual delete happens, that's why previous test missing this hunk (already covered by comment-admin list-builder and views test)
So just make sure the valid values are stored in tempstore is enough
That's what the action is doing, it prepares tempstore with ID's to delete.
The hunk specifically added to cover case of delete action.
See
\Drupal\Core\Action\Plugin\Action\Derivative\EntityDeleteActionDeriver::getDerivativeDefinitions()Comment #68
andypostBtw there's only
\Drupal\comment\Plugin\Action\UnpublishByKeywordCommentaction left in comment module, so delete test could be removedComment #70
daffie commented@andypost: Thank you for the explanation.
All changes now look good to me.
For me it is RTBC.
Comment #73
catchCommitted/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!