Skip to content

Commit 2b196cf

Browse files
committed
Fix for PHPUnit 9.5 and newer
1 parent 8c0e149 commit 2b196cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/SpeedTrapListener.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace JohnKary\PHPUnit\Listener;
55

66
use PHPUnit\Framework\{TestListener, TestListenerDefaultImplementation, TestSuite, Test, TestCase};
7+
use PHPUnit\Util\Test as TestUtil;
78

89
/**
910
* A PHPUnit TestListener that exposes your slowest running tests by outputting
@@ -222,7 +223,10 @@ protected function loadOptions(array $options)
222223
*/
223224
protected function getSlowThreshold(TestCase $test): int
224225
{
225-
$ann = $test->getAnnotations();
226+
$ann = TestUtil::parseTestMethodAnnotations(
227+
get_class($test),
228+
$test->getName(false)
229+
);
226230

227231
return isset($ann['method']['slowThreshold'][0]) ? (int) $ann['method']['slowThreshold'][0] : $this->slowThreshold;
228232
}

0 commit comments

Comments
 (0)