Skip to content
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

Add option to ignore covers annotation #573

Conversation

BackEndTea
Copy link

@BackEndTea BackEndTea commented Jan 5, 2018

This PR:

If preferred, i can also make a PR against v5.3 instead

@BackEndTea BackEndTea force-pushed the feature/ignore-covers-annotation branch from c17138a to be5c988 Compare January 5, 2018 13:42
@BackEndTea BackEndTea closed this Mar 20, 2018
@ivastly
Copy link

ivastly commented May 1, 2019

@BackEndTea why it was closed and not merged? Souds useful. Corresponding stackoverflow question here.

@JeroenDeDauw
Copy link
Sponsor Contributor

Yes, this would be very useful. Right now I can't use the coverage report in several of my projects without either removing the @Covers tags or adding a whole lot that I think are better not added.

@JeroenDeDauw
Copy link
Sponsor Contributor

JeroenDeDauw commented May 1, 2019

Presumably this was closed because it sat here for one and a half year without any review.

@kubawerlos
Copy link
Contributor

Right now I can't use the coverage report

@JeroenDeDauw but you can - the whole point of @covers* annotations is to make coverage report more meaningful.

without either removing the @Covers tags or adding a whole lot

I don't understand what's your problem - you can run the PHPUnit with only some test classes having the @covers* annotations.

@JeroenDeDauw
Copy link
Sponsor Contributor

@kubawerlos are you saying I can literally add @covers* to an integration test to have PHPUnit mark all code it executes as covered?

@kubawerlos
Copy link
Contributor

No, I'm saying one way or another - benefit from @covers* annotations to know what was intentionally covered or remove them to cover all executed code.

What what you writing I understood you have the annotations, but sometimes you don't want to use them - that's what confuses me - what is the reason of the inconsistency?

@JeroenDeDauw
Copy link
Sponsor Contributor

When you follow something like the clean architecture, you end up with a bunch of use cases that hold application logic and typically each have a request model and a response model. These two model objects are simple DTOs and are not worth unit testing. There are other classes not worth unit testing. The integration tests for the use cases only have one covers tag: for the use case. They do not have a long list of all these other classes, which I think they should not be required to have. So even though my whole application is tested on a sensible level, code coverage shows (incorrectly) low, and is not usable for finding code that is not tested.

Example codebase: https://github.com/wmde/fundraising-donations

@fkupper
Copy link

fkupper commented May 2, 2019

Can't you just whitelist/blacklist what you want?

@JeroenDeDauw
Copy link
Sponsor Contributor

That would require many entries and create maintenance overhead. All in all, less preferred than not having the coverage work at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants