-
-
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
Do not error out on invalid @covers tag #1760
Comments
Some Why not simply fix such problem on an earlier stage so that invalid class/method will never appear in repository? Just check this in hook or static test. |
That would defeat the purpose of the feature, sorry. I agree with what was said in #1760 (comment) that code with invalid annotations must not exist to begin with by the time PHPUnit runs the tests. I already explained in #1758 (comment) that this would be the job of a separate tool. |
This is to detect incorrect @Covers tags before the code gets to ScutinizerCI. We are already doing this at https://github.com/wmde/WikibaseDataModelServices/blob/master/composer.json A better approach would be nice though, considering this slows down the execution of the test command by doing a lot of not needed work. Apparently this is not going to come from the PHPUnit side though, as per sebastianbergmann/phpunit#1760
This is to detect incorrect @Covers tags before the code gets to ScutinizerCI. We are already doing this at https://github.com/wmde/WikibaseDataModelServices/blob/master/composer.json A better approach would be nice though, considering this slows down the execution of the test command by doing a lot of not needed work. Apparently this is not going to come from the PHPUnit side though, as per sebastianbergmann/phpunit#1760
@sebastianbergmann I see that you already answered regarding verifying the In case it's a bug, I'm using PHPUnit 5.2.3 on PHP 5.6.18 with Xdebug 2.3.3. My PHPUnit config is: <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
bootstrap="bootstrap/autoload.php"
colors="true"
forceCoversAnnotation="true">
<testsuites>
<testsuite name="App tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit> |
In my projects I have a ci command that runs PHPUnit and some other stuff. This is also what TravisCI runs. The only difference is that TravisCI also runs code coverage generation (via PHPUnit) afterwards. This means the TravisCI build can fail due to a typo in an @Covers tag, which will only show up when running coverage generation.
One fix is to execute
phpunit --coverage-text=/dev/null
. That will then fail as desired if a @Covers tag got messed up. That however slows the command down significantly. On one project from ~850ms to ~18s.Is there a way to have PHPUnit not error out during coverage report generating when a @Covers tag is wrong? If not, consider this a feature request.
Currently using
PHPUnit 4.7.3
, though I've been running into this for years.The text was updated successfully, but these errors were encountered: