mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 18:57:22 +01:00
fix fqn for coversClass
This commit is contained in:
@ -32,6 +32,11 @@ final class Covers extends Attribute
|
|||||||
{
|
{
|
||||||
foreach ($method->covers as $covering) {
|
foreach ($method->covers as $covering) {
|
||||||
if ($covering instanceof CoversClass) {
|
if ($covering instanceof CoversClass) {
|
||||||
|
// Prepend a backslash for FQN classes
|
||||||
|
if (str_contains($covering->class, '\\')) {
|
||||||
|
$covering->class = '\\' . $covering->class;
|
||||||
|
}
|
||||||
|
|
||||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversClass({$covering->class}::class)]";
|
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversClass({$covering->class}::class)]";
|
||||||
} else if ($covering instanceof CoversFunction) {
|
} else if ($covering instanceof CoversFunction) {
|
||||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversFunction('{$covering->function}')]";
|
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversFunction('{$covering->function}')]";
|
||||||
|
|||||||
@ -166,7 +166,7 @@ final class TestCaseFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
$classAttributes = implode('', array_map(
|
$classAttributes = implode('', array_map(
|
||||||
static fn ($attribute) => sprintf("\n %s", $attribute),
|
static fn (string $attribute) => sprintf("\n %s", $attribute),
|
||||||
array_unique($classAttributes),
|
array_unique($classAttributes),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user