-
Notifications
You must be signed in to change notification settings - Fork 53
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
[AnnotationsToAttributes] Fix @covers qualified::method conversion #451
[AnnotationsToAttributes] Fix @covers qualified::method conversion #451
Conversation
Please run:
to fix CI |
Apologies @samsonasik, I thought I'd created this as a draft request. I've cleaned up coding style now. |
did you forget git push? |
6e74eb8
to
cb2f9eb
Compare
Indeed I did. It's one of 'those' days. |
cb2f9eb
to
928e6e3
Compare
I don't follow latest Covers* in PHPUnit for class method, last time old days, it was not exists, or I was looking to different things. If you already verify it, let's give it a try :) |
Thank you @andrewnicols |
It looks like the
Given there is no ability to specify this in PHPUnit 10, and removing the method altogether would cause data loss that is the loss of the coverage information) there are some options:
|
Ugh, what a mess, it seems ok with coverage loss, as unknown class attribute seems not error, see https://3v4l.org/iqNL1 except you have other option |
The PHPUnit 9.6
@covers
annotation supports specification of methods:https://docs.phpunit.de/en/9.6/annotations.html#covers
That is:
The
CoversAnnotationWithValueToAttributeRector
conversion is currently unaware of this and converting it to aCoversClass
attribute, that is:This is, of course, a syntax error. It should create a
CoversMethod
attribute:This patch changes the behaviour to look for a
::
in the annotation and, if found, grab the class and use theCoversMethod
Attribute with the class and method name. The behaviour for an annotation that starts with::
is unaffected.