pest-plugin-drift
pest-plugin-drift copied to clipboard
Covers annotations are not converted
If you use e.g. the #[CoversClass(Foo::class)] annotation, then it is not converted to a ->covers() chained call on the test. This means that if you have requireCoverageMetadata="true" in your phpunit.xml config, all tests will fail.
Input
#[CoversClass(Foo::class)]
class MyTest extends TestCase {
public function testItDoesThing()
{
…
}
}
Actual Output
test('it does thing', function () {
…
});
And:
WARN Tests\Unit\MyTest
! it does thing → This test does not define a code coverage target but is expected to do so
Expected Output
test('it does thing', function () {
…
})->covers(Foo::class);