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.
Comments
Comment #3
nicrodgersComment #4
paraderojether commentedHi
I reviewed MR!44, and confirmed that the phpunit is now passed on Gitlab CI.
Moving this to RTBC.
Thank you.
Comment #7
alexpottThanks for the MR @nicrodgers