-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Remove support for "ClassName<*>" as values for @covers and @uses annotations #3631
Comments
I'm just wondering whether there will be any replacement for these and what the rationale is. Generally I/we prefer to only |
The test is still supposed to figure out whether the internals of your system are sound and well covered or not. Having
|
…stead of a CodeUnit object (even if only a single CodeUnit object is to be returned) The purpose of this component is to help with refactoring how information from @Covers and @uses annotations is passed from phpunit/phpunit to phpunit/php-code-coverage, see sebastianbergmann/php-code-coverage#519 for details. I want this to happen sooner rather than later and do not want to wait for PHPUnit 10 and sebastianbergmann/phpunit#3631. This means that, at least until PHPUnit 10, this component needs to support these strings for CodeUnit::fromString(): * ClassName::<public> * ClassName::<protected> * ClassName::<private> * ClassName::<!public> * ClassName::<!protected> * ClassName::<!private>
Hi, somewhat late to the game here, but I agree with @andrewnicols's philosophy on coverage, and this is already blocking me from upgrading to 9.x due to (presumably) some change in the docblock parser that was probably related to plans for this. I'll assume for discussion purposes that breakage is a bug, but it would be just as relevant in the future if this happens for PHPUnit 10. My tests all start off with the following: /**
* @coversDefaultClass Company\Project\My
* @covers ::<protected>
* @covers ::<private>
*/
class MyTest extends \PHPUnit\Framework\TestCase
{ Tests can and do figure out whether the internals of my code are sound, and the coverage reports confirm as much. Test cases interact with the public APIs, and exercise logic that's contained in the public and private APIs. The coverage reports for public APIs must be explicit, and anything internal is an implementation detail. In my opinion, it's actively harmful for tests to be forced to know which private/protected methods any public API uses for the purpose of generating coverage reports, but as of the docs for 9.3, the only recommended way to annotate coverage is class-wide; even covering specific class methods is explicitly "not recommended". So while my gut reaction is that this isn't entirely a good direction to go, I'm open to alternatives. Maybe the best practices in the documentation could be made clearer? My current approach is based on a test generator skeleton that probably dates back to PHPUnit 4 or so. It would be really nice to not introduce code churn on thousands of test files in an upgrade, but if there's a better way I'll deal with it. To be clear: I have no issue with dropping |
@sebastianbergmann it would be good to have some discussion on what the expected alternative is here. |
What is the alternative for the following now?
Class All private methods that are called by |
PHPUnit 10 should not support the following annotations anymore:
@covers ClassName::<public>
@covers ClassName::<protected>
@covers ClassName::<private>
@covers ClassName::<!public>
@covers ClassName::<!protected>
@covers ClassName::<!private>
@covers ClassName<extended>
@uses ClassName::<public>
@uses ClassName::<protected>
@uses ClassName::<private>
@uses ClassName::<!public>
@uses ClassName::<!protected>
@uses ClassName::<!private>
@uses ClassName<extended>
The text was updated successfully, but these errors were encountered: