phpunit
phpunit copied to clipboard
Option to mark test as risky when it does not generate code coverage
Suggested by @spriebsch:
When code coverage analysis is active then a test that is not annotated with @coversNothing
and does not contribute to code coverage should be marked as risky.
Motivation: We frequently see "tests" like this:
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class ExampleTest extends TestCase
{
public function testSomething(): void
{
$this->assertTrue(true);
}
}
This is done in order to prevent the test from being marked as risky because it does not assert anything and/or to create the false impression that a project has tests.
Thanks for being my GitHub proxy, again ;-)
Hi @sebastianbergmann and @spriebsch, I think this is a nice idea! I would love to help and made a quick prove of concept. Is this the place and way you thought of, or would you tackle this completely different? https://github.com/sebastianbergmann/phpunit/compare/master...R4c00n:risky-because-no-coverage?expand=1
As I said, this is just a quick POC. Still missing proper tests and configuration options and stuff.