public static function parseTestMethodAnnotations($className, $methodName = '')
{
if (!isset(self::$annotationCache[$className])) {
$class = new ReflectionClass($className);
$traits = $class->getTraits();
$annotations = [];
foreach ($traits as $trait) {
$annotations = array_merge($annotations, self::parseAnnotations($trait->getDocComment()));
}
self::$annotationCache[$className] = array_merge($annotations, self::parseAnnotations($class->getDocComment()));
}
if (!empty($methodName) && !isset(self::$annotationCache[$className . '::' . $methodName])) {
try {
$method = new ReflectionMethod($className, $methodName);
$annotations = self::parseAnnotations($method->getDocComment());
} catch (ReflectionException $e) {
$annotations = [];
}
self::$annotationCache[$className . '::' . $methodName] = $annotations;
}
return ['class' => self::$annotationCache[$className], 'method' => !empty($methodName) ? self::$annotationCache[$className . '::' . $methodName] : []];
}