mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 18:57: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) {
|
foreach ($method->covers as $covering) {
|
||||||
if ($covering instanceof CoversClass) {
|
if ($covering instanceof CoversClass) {
|
||||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversClass({$covering->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}')]";
|
||||||
} else {
|
} else {
|
||||||
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversNothing]";
|
$attributes[] = "#[\PHPUnit\Framework\Attributes\CoversNothing]";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,13 +159,15 @@ final class TestCaseFactory
|
|||||||
|
|
||||||
foreach (self::$attributes as $attribute) {
|
foreach (self::$attributes as $attribute) {
|
||||||
if ($attribute::ABOVE_CLASS) {
|
if ($attribute::ABOVE_CLASS) {
|
||||||
/** @phpstan-ignore-next-line */
|
foreach ($methods as $methodFactory) {
|
||||||
$classAttributes = (new $attribute())->__invoke($this, $classAttributes);
|
$classAttributes = (new $attribute())->__invoke($methodFactory, $classAttributes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$classAttributes = implode('', array_map(
|
$classAttributes = implode('', array_map(
|
||||||
static fn ($attribute) => sprintf("\n %s", $attribute), $classAttributes,
|
static fn ($attribute) => sprintf("\n %s", $attribute),
|
||||||
|
array_unique($classAttributes),
|
||||||
));
|
));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user