Skip to content

Commit 3ede29a

Browse files
authored
detect Test Attribute in TestsNodeAnalyzer::isTestClassMethod
1 parent 96b3565 commit 3ede29a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/NodeAnalyzer/TestsNodeAnalyzer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ public function isTestClassMethod(ClassMethod $classMethod): bool
5858
return true;
5959
}
6060

61+
foreach ($classMethod->getAttrGroups() as $attrGroup) {
62+
$hasTestAttribute = array_any(
63+
$attrGroup->attrs,
64+
static fn($attribute): bool => $attribute->name->toString() === 'PHPUnit\\Framework\\Attributes\\Test'
65+
);
66+
if ($hasTestAttribute) {
67+
return \true;
68+
}
69+
}
70+
6171
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
6272
return $phpDocInfo->hasByName('test');
6373
}

0 commit comments

Comments
 (0)