The following four deprecation messages are globally suppressed in DeprecationListenerTrait

'CommentVariable is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.',
'CommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d7\NodeType instead.',
'CommentVariablePerCommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.',
'The Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use Drupal\migrate_drupal\Plugin\migrate\source\d6\VariableTranslation',

Core does not actually trigger these deprecation notices except in the tests specifically testing the deprecated classes, so they should be removed from the global list and the individual tests should be labeled as legacy with the appropriate expected deprecations.

Comments

mikelutz created an issue. See original summary.

mikelutz’s picture

Title: Remove references toi18Variable, CommentType, CommentVariable and CommentVariablePerCommentType from the global deprecation listener list. » Remove references to i18Variable, CommentType, CommentVariable and CommentVariablePerCommentType from the global deprecation listener list.
mikelutz’s picture

mile23’s picture

Status: Needs review » Reviewed & tested by the community

I see one green test, so I feel safe with RTBC.

+++ b/core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d6/CommentVariablePerCommentTypeTest.php
@@ -3,20 +3,36 @@
+  use ExpectDeprecationTrait;
...
+  public function testSource(array $source_data, array $expected_data, $expected_count = NULL, array $configuration = [], $high_water = NULL) {
+    $this->expectDeprecation('CommentVariablePerCommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.');
+    $this->expectDeprecation('CommentVariable is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.');
+    parent::testSource($source_data, $expected_data, $expected_count, $configuration, $high_water);

I feel a little nitpicky about this pattern, because the string literals are completely literal and don't need to be assembled. They maybe should be @expectedDeprecation annotations.

Other than the minor nit, LGTM.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

@mikelutz thanks for working on this. It's great to see this being tackled.

I agree with @Mile23 let's not use the ExpectedDeprecationTrait unnecessarily. Also it would be good to confirm that we have matching non-legacy test coverage.

For example for i18nVariable we have both:

  • \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d6\i18nVariableTest
  • \Drupal\Tests\migrate_drupal\Unit\source\d6\i18nVariableTest (already a legacy test)

But for we have VariableTranslation:

  • \Drupal\Tests\migrate_drupal\Unit\source\d6\VariableTranslationTest

So are we losing test coverage in any way?

mikelutz’s picture

We aren't losing test coverage with this patch, but it looks like we did miss adding the kernel test for VariableTranslation in #2861383: Rename i18n migrations to _translation

In #2791119: Write meaningful Migrate source tests kernel tests for sources became favored over unit tests, so the kernel test for variable translation should definitely be created. I created a novice issue #3004684: Create a Kernel Test for VariableTranslation source plugin to do that, because I don't feel it belongs in this issue, it's a follow up to 2861383..

The other three sources were replaced with the NodeType source in comment migrations in #2887142: NodeType source plugin should include comment information, and that source and the new comment migrations are thoroughly covered in tests.

I moved the deprecation expectations into annotations. For some reason I didn't know they could go there, I thought ExpectDeprecationTrait was the only way to declare them. Lesson learned.

alexpott’s picture

@mikelutz but atm the i18Variable kernel test is a kernel test of VariableTranslation - because i18Variable extends VariableTranslation. With this change we're marking it for removal so either #3004684: Create a Kernel Test for VariableTranslation source plugin is a blocker or we need to do it here.

mikelutz’s picture

mikelutz’s picture

Title: Remove references to i18Variable, CommentType, CommentVariable and CommentVariablePerCommentType from the global deprecation listener list. » Remove references to i18nVariable, CommentType, CommentVariable and CommentVariablePerCommentType from the global deprecation listener list.
quietone’s picture

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

@mikelutz explained what's happening in this patch to me, since I was confused about why we are adding a completely new test here. It makes sense now. Let's do it.

phenaproxima’s picture

Issue tags: +Needs reroll

Dang.

mikelutz’s picture

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs reroll

Thanks! RTBC when green.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 44b86a4 and pushed to 8.7.x. Thanks!

  • alexpott committed 44b86a4 on 8.7.x
    Issue #3004428 by mikelutz, alexpott, Mile23: Remove references to...

Status: Fixed » Closed (fixed)

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