Problem/Motivation

PHPunit is reporting a number of deprecations, relating to the deprecation of annotations in favour of attributes.

Steps to reproduce

./vendor/bin/phpunit --configuration web/core/phpunit.xml.dist web/modules/contrib/node_revision_delete/
PHPUnit 11.5.41 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.17
Configuration: /var/www/html/web/core/phpunit.xml.dist

DDDDD                                                               5 / 5 (100%)

Time: 00:06.162, Memory: 6.00 MB

There were 6 PHPUnit test runner deprecations:

1) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

2) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

3) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

4) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

5) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

6) Metadata found in doc-comment for class Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

--

5 tests triggered 2 deprecations:

1) /var/www/html/web/core/tests/Drupal/KernelTests/KernelTestBase.php:769
Installing the table sequences with the method KernelTestBase::installSchema() is deprecated in drupal:10.2.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/3349345

Triggered by:

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteAmount
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:70

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteCreated
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:121

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteDrafts
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:179

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteIntegration
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:250

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteMultiLingual
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:403

2) /var/www/html/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:169
Not supporting attribute discovery in Drupal\Core\Plugin\DefaultPluginManager is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Provide an Attribute class and an Annotation class for BC. See https://www.drupal.org/node/3395582

Triggered by:

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteAmount
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:70

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteCreated
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:121

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteDrafts
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:179

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteIntegration
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:250

* Drupal\Tests\node_revision_delete\Kernel\NodeRevisionDeleteTest::testNodeRevisionDeleteMultiLingual
  /var/www/html/web/modules/contrib/node_revision_delete/tests/src/Kernel/NodeRevisionDeleteTest.php:403

OK, but there were issues!
Tests: 5, Assertions: 224, Deprecations: 2, PHPUnit Deprecations: 6.

Proposed resolution

Update the deprecated code. The new code is supported in 10.2+ (which is also what this module supports) so I don't think we have to worry about this being a breaking change.

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

nicrodgers created an issue. See original summary.

nicrodgers’s picture

Status: Active » Needs review
paraderojether’s picture

Status: Needs review » Reviewed & tested by the community

Hi

I reviewed MR!44, and confirmed that the phpunit is now passed on Gitlab CI.

Moving this to RTBC.
Thank you.

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

  • alexpott committed 9c8e5a2b on 2.0.x
    task: #3554216 Fix deprecations reported by phpunit
    
    By: nicrodgers
    
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the MR @nicrodgers

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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