Problem/Motivation

Running PHPunit tests, the results includes these two self deprecation notices:

Remaining self deprecation notices (7145)

  7020x: The Drupal\Core\Extension\Discovery\RecursiveExtensionFilterIterator is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Extension\Discovery\RecursiveExtensionFilterCallback instead. See https://www.drupal.org/node/3343023
    2080x in AnnotationProcessingTest::setUp from Drupal\Tests\rules\Unit\Integration\Engine
    1040x in UnBanIpTest::setUp from Drupal\Tests\rules\Unit\Integration\RulesAction
    1040x in BanIpTest::setUp from Drupal\Tests\rules\Unit\Integration\RulesAction
    780x in PathHasAliasTest::setUp from Drupal\Tests\rules\Unit\Integration\Condition
    780x in PathAliasExistsTest::setUp from Drupal\Tests\rules\Unit\Integration\Condition
    ...

  122x: Calling FieldTypePluginManager::__construct() without the $fieldTypeCategoryManager argument is deprecated in drupal:10.2.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3375737
    19x in IntegrityCheckTest::setUp from Drupal\Tests\rules\Unit\Integration\Engine
    10x in LoopTest::setUp from Drupal\Tests\rules\Unit\Integration\Engine
    5x in UserUnblockTest::setUp from Drupal\Tests\rules\Unit\Integration\RulesAction
    5x in EntityFetchByFieldTest::setUp from Drupal\Tests\rules\Unit\Integration\RulesAction
    5x in UserRoleAddTest::setUp from Drupal\Tests\rules\Unit\Integration\RulesAction
    ...

This isn't urgent now but will need to be done before a Drupal 11 version and shouldn't hurt to do ASAP in the next release.

Steps to reproduce

Run phpunit --testsuite="unit" with rules installed.

Proposed resolution

The first one sounds like a straightforward swapping out one function for another. The other needs a new parameter so I don't know how much that entails.

Issue fork rules-3437436

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ryanrobinson_wlu created an issue. See original summary.

tr’s picture

Version: 8.x-3.0-alpha8 » 8.x-3.x-dev
Category: Bug report » Task

Yes, deprecations are introduced into core all the time - this is just a normal part of keeping the module up-to-date, not a bug.

That's why we have automated testing - so we see these things. It's not necessary to post an issue for notices in the tests unless you want to provide a patch to address these issues.

The deprecation notices are simply notices that something will be changing in the future - in this case the current code is just fine and will be fine until Drupal 11.

Are you planning on providing a patch for this issue?

ankitv18 made their first commit to this issue’s fork.

tr’s picture

Title: Unit test deprecation notices » [10.2] RecursiveExtensionFilterIterator is deprecated
Version: 8.x-3.x-dev » 4.0.x-dev

The first issue is because of the core Drupal change made in RecursiveExtensionFilterIterator is deprecated

The second one is a duplicate of your issue in #3425542: [10.2] PHPUnit errors: non-existent service plugin.manager.field.field_type_category, and there is a fix in that issue.

I have changed the issue title to reflect that the first one is the only one that needs to be addressed here.

ankitv18’s picture

Assigned: Unassigned » ankitv18

Will raise a MR against 4.0.x considering comment#5

ankitv18’s picture

@TR getting this error when I'm trying to create branch
Failed to create branch '3437436-fix-deprecation': invalid reference name '4.0.x'

ankitv18’s picture

Assigned: ankitv18 » Unassigned
Status: Active » Needs review

MR!34 is ready for review. Fixed the objective of the ticket ~~ phpunit isn't failing due to deprecated RecursiveExtensionFilterIterator

tr’s picture

Status: Needs review » Needs work

Two things:

  1. Don't need the conditional because 4.0.x is going to have a minimum of Drupal 10.3. (The requirements haven't been changed yet in composer.json because, with the other 10.3 problem, I don't want to people switching to 4.0.x yet until I know it's working in 10.3).
  2. You're not using the new class correctly. See the change notice at RecursiveExtensionFilterIterator is deprecated for details.
ankitv18’s picture

Status: Needs work » Needs review

Alright, considering your feedback removed conditional statement and fixed the proper implementation as per change notice.
Earlier I went through the codebase to implement the approach. :(

  • TR committed 7a1ebfd2 on 4.0.x authored by ankitv18
    Issue #3437436 by ankitv18: [10.2] RecursiveExtensionFilterIterator is...
tr’s picture

Status: Needs review » Fixed

Thanks, looks good. I made some changes to the comments and merged.

Status: Fixed » Closed (fixed)

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