- Issue created by @mondrake
- 🇮🇹Italy mondrake 🇮🇹
Currently developing a Rector script for this in https://github.com/mondrake/d8-unit/blob/test-rector/rector.php
- 🇦🇺Australia mstrelan
Updated IS to clarify this is required in PHPUnit 12, not 11.
In PHPUnit 11, we have to replace test annotations with attributes. As noticed in #3417066-120: Upgrade PHPUnit to 10, drop Symfony PHPUnit-bridge dependency → ,
we can't mix PHPUnit attributes and annotations [in a single file], we will have to convert them all at once unfortunately
with thousands of test classes in Drupal, we should try to automate the conversion, in a way that a script can be executed on a file and convert it end-to-end.
Rector can help, but we need an overall Rector script that will do all the changes necessary in a go - we should convert by files or group of files, and not by rule/annotation.
Listing some findings for the Rector rule, will document here along
@group legacy
is a symfony/phpunit-bridge concept. It must be converted to the #[IgnoreDeprecations]
attribute, however:@coversDefaultClass
and @covers
needs complete rethinking as there is NO one-to-one conversion: CoversAnnotationWithValueToAttributeRector
may not be fit for purpose because (a) does not manage short class names + use import and (b) it does not take into account the existence of [#CoversMethod] that was only (re)introduced in PHPUnit 11.1Currently developing a Rector script for this in https://github.com/mondrake/d8-unit/blob/test-rector/rector.php
Updated IS to clarify this is required in PHPUnit 12, not 11.