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.
Problem/Motivation
Several actions in the \Drupal\comment\Action\Plugin\Action\ namespace are deprecated in Drupal 8.5.x and will be removed before 9.0.0. Deprecation messages should be moved from skipped to expected for these.
See also change notice 2919303
Affected classes
- Drupal\comment\Plugin\Action\PublishComment replaced by \Drupal\Core\Action\Plugin\Action\PublishAction
- Drupal\comment\Plugin\Action\SaveComment replaced by \Drupal\Core\Action\Plugin\Action\SaveAction
- Drupal\comment\Plugin\Action\UnpublishComment replaced by \Drupal\Core\Action\Plugin\Action\UnpublishAction
Proposed resolution
- Use \Drupal\Core\Action\Plugin\Action\PublishAction instead of Drupal\comment\Plugin\Action\PublishComment
- Use \Drupal\Core\Action\Plugin\Action\SaveAction instead of Drupal\comment\Plugin\Action\SaveComment
- Use \Drupal\Core\Action\Plugin\Action\UnpublishAction instead of Drupal\comment\Plugin\Action\UnpublishComment
Remaining tasks
- Remove skipped deprecations from DeprecationListenerTrait.
- Replace occurrences of skipped deprecations with expected deprecations where appropriate.
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#32 | mutlilingual.txt | 1.66 KB | volkerk |
#32 | testing_config_install.txt | 25.89 KB | volkerk |
#30 | 2973791-30.patch | 101.94 KB | alexpott |
#30 | 28-30-interdiff.txt | 45.39 KB | alexpott |
#28 | 2973791-28.patch | 56.54 KB | alexpott |
Comments
Comment #2
mairi CreditAttribution: mairi commentedComment #3
mairi CreditAttribution: mairi commentedI'm looking at this at DrupalCamp Scotland
Comment #4
mairi CreditAttribution: mairi commentedComment #5
mairi CreditAttribution: mairi commentedComment #6
mairi CreditAttribution: mairi commentedComment #7
mairi CreditAttribution: mairi commentedComment #8
mairi CreditAttribution: mairi commentedRemoving deprecation exceptions for SaveComment, PublishComment and UnpublishComment.
Comment #9
mairi CreditAttribution: mairi at The University of Edinburgh commentedComment #10
mairi CreditAttribution: mairi at The University of Edinburgh commentedStill looking that this, but ran out of time during DrupalCamp Scotland due to trouble with testing locally so I can't reproduce test failures to be sure I'm eliminating failures. I've switched to a different local setup to try to resolve testing issues but not quite there yet!
Comment #11
alexpottHi @mairi thanks for working on this. These deprecations are triggered by out update tests. We need to add the
@group legacy
to all concrete (ie. not abstract) tests that extend \Drupal\FunctionalTests\Update\UpdatePathTestBase and then we should be able to make some headway in removing these.Comment #12
mairi CreditAttribution: mairi at The University of Edinburgh commentedThanks for clarifying @alexpott - I was unsure whether it was better to handle at abstract or concrete layer so this is really helpful.
Comment #13
martin107 CreditAttribution: martin107 as a volunteer commentedin the end I modified every concrete class.
Comment #15
martin107 CreditAttribution: martin107 as a volunteer commentedI will clear the last 15
Comment #16
martin107 CreditAttribution: martin107 as a volunteer commentedI want to work in small tightly focused steps.
These next changes are ones which I can clearly see are one level away from extending UpdatePathTestBase
It does not fix all the issues...but hey that is the nature of small but justifiable concrete steps.
Comment #18
martin107 CreditAttribution: martin107 as a volunteer commentedI would appreciate some advice. The remaining errors share a common thread. [ namely the use of UpdatePathTestBase::runUpdates(). ]
UpdatePathTestBase is a abstract class and so subject to the maxim from #11 about not adding @legacy tags.
What is the solution here ????
Taking FileUpdateTest as a example of the problem ... should it be rewritten so that it no longer extends UpdatePathTestBase.. that would solve the problem ... I guess but maybe that is for another issue?
In minor news .. the patch here just scoops up a single failing test that should have been included in #16
Comment #19
alexpott@martin107 - the problem is that the failing tests are extending
\Drupal\simpletest\WebTestBase
we need to convert them to BrowserTestBase test. There are probably existing issues for this.Comment #21
alexpottSo WebTestBase tests don't support multiple groups - there is an issue but we're unlikely to do it because webtestbase are on the way out.
Here's a fix to make WtB respect the
@group legacy
.Comment #22
martin107 CreditAttribution: martin107 as a volunteer commentedThanks for the expert touch .. that is really appreciated.
The patch is coding standard violation free... and with hindsight that is a really good solution
So I think this patch is ready to commit....
alexpott++
Comment #23
borisson_The only relevante code-change for this issue is in WebTestBase.
That change seems to make a lot of sense.
Comment #24
alexpottIt's likely we can remove more skipped deprecations here. At the very least we should remove all the obviously related...
ie
and
Comment #25
alexpottComment #26
martin107 CreditAttribution: martin107 as a volunteer commentedLGTM
Comment #28
alexpottRe-rolled... let's find out if any new update tests have been added since 31st May.
Comment #30
alexpottNice so doing this shows how necessary this is to keep all the tests honest. It's caught the fact that the config used in the install from existing config is out-of-date.
The configuration had action plugins configured with the old IDs.
Comment #31
volkerk CreditAttribution: volkerk commentedFixes deprecation issues in #2642122: Overriding already overridden libraries-override requires knowledge of previous libraries-overrides.
Looks good!
Comment #32
volkerk CreditAttribution: volkerk commentedI forgot to mention: I did diff the tarballs: uuids and config hashes have changed in testing_config_install.tar.gz, while they did not in multilingual.tar.gz, but anyway looks fine.
Find the diffs attached.
Comment #33
catchCommitted 163144a and pushed to 8.6.x. Thanks!
Comment #35
tim.plunkettWhere's the CR saying that you have to use
@group legacy
on any UpdatePathTestBase subclass?Comment #36
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThe reason these updates tests trigger the deprecation warnings is because we're doing this in a post update hook using entity API and not modifying the raw configuration values. See some of the motivation behind that here. It illustrates an interesting point however, if the deprecated plugin classes were removed, won't we break the continuity of the update hooks and 9.0.0 would essentially require
system_post_update_change_action_plugins
to already have run?Realistically it probably wont be an issue in this case, but it might be worth documenting that adding
@legacy
to an update test means:I wonder if a better fix here would be to revisit using the configuration API instead? The code could still live in post-update, given we wouldn't want to mess with any sites that had already run these hooks.
Comment #37
tim.plunkettI really don't care why something is broken in this case.
I just know that before this commit, I could write update path tests, and now those tests fail. And after debugging, everything points to this issue. But it would have been nice for a CR to explain why everything went sideways
Comment #38
alexpottCreated a CR - https://www.drupal.org/node/2985785 and filed a followup issue to add documentation to
\Drupal\FunctionalTests\Update\UpdatePathTestBase
. Sorry for not doing this.Comment #39
tim.plunkettMuch appreciated, thanks.
Future idea for a follow-up: magically opt all
@group Update
into the legacy group behind the scenes...