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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mairi created an issue. See original summary.

mairi’s picture

Issue summary: View changes
mairi’s picture

I'm looking at this at DrupalCamp Scotland

mairi’s picture

Issue summary: View changes
mairi’s picture

Issue summary: View changes
mairi’s picture

Title: Fix deprecation messages related to deprecated Action plugins » Fix deprecation messages related to deprecated comment Action plugins
Issue summary: View changes
mairi’s picture

Issue summary: View changes
mairi’s picture

Removing deprecation exceptions for SaveComment, PublishComment and UnpublishComment.

mairi’s picture

mairi’s picture

Still 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!

alexpott’s picture

Hi @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.

mairi’s picture

Thanks for clarifying @alexpott - I was unsure whether it was better to handle at abstract or concrete layer so this is really helpful.

martin107’s picture

Status: Active » Needs review
FileSize
47.66 KB
45.34 KB

in the end I modified every concrete class.

Status: Needs review » Needs work

The last submitted patch, 13: 2973791-13.patch, failed testing. View results

martin107’s picture

Assigned: Unassigned » martin107

I will clear the last 15

martin107’s picture

Status: Needs work » Needs review
FileSize
53.85 KB
6.19 KB

I 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.

Status: Needs review » Needs work

The last submitted patch, 16: 2973791-16.patch, failed testing. View results

martin107’s picture

Assigned: martin107 » Unassigned
Status: Needs work » Needs review
FileSize
54.56 KB
719 bytes

I 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

alexpott’s picture

@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.

Status: Needs review » Needs work

The last submitted patch, 18: 2973791-18.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
FileSize
2.9 KB
55.43 KB

So 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.

martin107’s picture

Thanks 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++

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

The only relevante code-change for this issue is in WebTestBase.
That change seems to make a lot of sense.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

It's likely we can remove more skipped deprecations here. At the very least we should remove all the obviously related...
ie

      'Drupal\node\Plugin\Action\PublishNode is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\PublishAction instead. See https://www.drupal.org/node/2919303.',
      'Drupal\node\Plugin\Action\SaveNode is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\SaveAction instead. See https://www.drupal.org/node/2919303.',
      'Drupal\node\Plugin\Action\UnpublishNode is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\UnpublishAction instead. See https://www.drupal.org/node/2919303.',

and

      'Drupal\node\Plugin\Action\DeleteNode is deprecated in Drupal 8.6.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\DeleteAction instead. See https://www.drupal.org/node/2934349.',
      'Drupal\comment\Plugin\Action\DeleteComment is deprecated in Drupal 8.6.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\DeleteAction instead. See https://www.drupal.org/node/2934349.',
alexpott’s picture

Status: Needs work » Needs review
FileSize
3.26 KB
57.03 KB
martin107’s picture

LGTM

Status: Needs review » Needs work

The last submitted patch, 25: 2973791-25.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
FileSize
56.54 KB

Re-rolled... let's find out if any new update tests have been added since 31st May.

Status: Needs review » Needs work

The last submitted patch, 28: 2973791-28.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
FileSize
45.39 KB
101.94 KB

Nice 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.

volkerk’s picture

Status: Needs review » Reviewed & tested by the community
volkerk’s picture

I 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.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 163144a and pushed to 8.6.x. Thanks!

  • catch committed 163144a on 8.6.x
    Issue #2973791 by alexpott, martin107, mairi, volkerk: Fix deprecation...
tim.plunkett’s picture

Where's the CR saying that you have to use @group legacy on any UpdatePathTestBase subclass?

Sam152’s picture

The 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:

  • The test will likely hard-fail when the deprecated code is deleted.
  • The minimum schema version for an update to the next major version becomes > than the failing hook.

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.

tim.plunkett’s picture

I 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

alexpott’s picture

Created 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.

tim.plunkett’s picture

Much appreciated, thanks.

Future idea for a follow-up: magically opt all @group Update into the legacy group behind the scenes...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.