-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
replace PHPUnit annotations with attributes #61299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
Conversation
xabbuh
commented
Aug 1, 2025
Q | A |
---|---|
Branch? | 7.4 |
Bug fix? | no |
New feature? | no |
Deprecations? | no |
Issues | |
License | MIT |
this is a first step towards running our tests with PHPUnit 12.3, contains #58370 which needs to be merged first |
482bc5d
to
4d390cb
Compare
This has to be automated. Is that the case? |
@@ -19,6 +20,7 @@ | |||
* | |||
* @covers \Symfony\Bridge\PhpUnit\ClockMock | |||
*/ | |||
#[CoversClass(ClockMock::class)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting here in the diff, the annotations sometimes remain and only the attributes are added, also see next case src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intended because we need to ensure that the PhpUnitBridge is working with PHPUnit 9.6 (we have a job for that) where the attributes don’t exist.
4d390cb
to
e8f65ff
Compare
/** | ||
* @covers \DateTime | ||
*/ | ||
#[\PHPUnit\Framework\Attributes\CoversClass(DateTime::class)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be imported?
* ["Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\Bundle\\AuthenticatorBundle\\ApiAuthenticator"] | ||
*/ | ||
#[TestWith(['form_login'])] | ||
#[TestWith(['Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle\ApiAuthenticator'])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using ::class
here:
#[TestWith(['Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle\ApiAuthenticator'])] | |
#[TestWith([ApiAuthenticator::class])] |
/** | ||
* @requires function \Symfony\Bundle\MercureBundle\MercureBundle::build | ||
*/ | ||
#[RequiresFunction('Symfony\Bundle\MercureBundle\MercureBundle::build')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should RequiresMethod
be used instead:
#[RequiresFunction('Symfony\Bundle\MercureBundle\MercureBundle::build')] | |
#[RequiresMethod(MercureBundle::class, 'build')] |