mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
fix fqn on coversClass attribute and array evaluation
This commit is contained in:
@ -32,9 +32,9 @@ final class Covers extends Attribute
|
||||
{
|
||||
foreach ($method->covers as $covering) {
|
||||
if ($covering instanceof CoversClass) {
|
||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversClass({$covering->class}]";
|
||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversClass({$covering->class}::class)]";
|
||||
} else if ($covering instanceof CoversFunction) {
|
||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversFunction('{$covering->function}']";
|
||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversFunction('{$covering->function}')]";
|
||||
} else {
|
||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversNothing]";
|
||||
}
|
||||
|
||||
@ -159,13 +159,15 @@ final class TestCaseFactory
|
||||
|
||||
foreach (self::$attributes as $attribute) {
|
||||
if ($attribute::ABOVE_CLASS) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
$classAttributes = (new $attribute())->__invoke($this, $classAttributes);
|
||||
foreach ($methods as $methodFactory) {
|
||||
$classAttributes = (new $attribute())->__invoke($methodFactory, $classAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$classAttributes = implode('', array_map(
|
||||
static fn ($attribute) => sprintf("\n %s", $attribute), $classAttributes,
|
||||
static fn ($attribute) => sprintf("\n %s", $attribute),
|
||||
array_unique($classAttributes),
|
||||
));
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user