-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
feature/code-coverageIssues related to code coverage (but not php-code-coverage)Issues related to code coverage (but not php-code-coverage)feature/metadata/attributestype/bugSomething is brokenSomething is brokenversion/11Something affects PHPUnit 11Something affects PHPUnit 11
Description
Q | A |
---|---|
PHPUnit version | 11.1.1 |
PHP version | 8.3.4 |
Installation Method | Composer |
Summary
When i use CoversMethod
attribute, PHPUnit do not understand it is a coverage attribute.
If i replace CoversMethod
by CoversNothing
or CoversClass
, coverage error disapear.
Current behavior
CoversMethod do not configure the code coverage.
How to reproduce
#[CoversMethod(ToDelete::class, 'foo')]
final class ToDeleteTest extends TestCase
{
public function testFoo(): void
{
static::assertSame(1, (new ToDelete())->foo());
}
}
Result:
PHPUnit 11.1.1 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.4
Configuration: /app/config/ci/phpunit.xml
R 1 / 1 (100%)
Time: 00:00.003, Memory: 4.00 MB
There was 1 risky test:
1) App\Tests\ToDeleteTest::testFoo
This test does not define a code coverage target but is expected to do so
/app/tests/ToDeleteTest.php:17
OK, but there were issues!
Tests: 1, Assertions: 1, Risky: 1.
Expected behavior
Code coverage should be configured with this attribute, right?
Metadata
Metadata
Assignees
Labels
feature/code-coverageIssues related to code coverage (but not php-code-coverage)Issues related to code coverage (but not php-code-coverage)feature/metadata/attributestype/bugSomething is brokenSomething is brokenversion/11Something affects PHPUnit 11Something affects PHPUnit 11