website/errors/phpunit.covers.md
<?php declare(strict_types = 1);
/**
* @covers \App\NonExistentClass
*/
class MyTest extends \PHPUnit\Framework\TestCase
{
public function testSomething(): void
{
// ...
}
}
The @covers or @coversDefaultClass annotation references an invalid class, function, or method. This can happen when:
@coversDefaultClass is used on a method instead of a classThis rule is provided by the phpstan-phpunit extension.
Ensure the @covers annotation references an existing, fully qualified class or function:
<?php declare(strict_types = 1);
/**
- * @covers \App\NonExistentClass
+ * @covers \App\ExistingClass
*/
class MyTest extends \PHPUnit\Framework\TestCase
{
public function testSomething(): void
{
// ...
}
}
If the class name is not fully qualified, add the leading backslash:
<?php declare(strict_types = 1);
/**
- * @covers MyClass
+ * @covers \App\MyClass
*/
class MyTest extends \PHPUnit\Framework\TestCase
{
}