Skip to content

Commit 87513a7

Browse files
authored
Merge pull request #73 from mvorisek/fix_phpunit_9.5
Fix for PHPUnit 9.5 and newer (fix removed removed getAnnotations() method)
2 parents 3c15eb5 + 2b196cf commit 87513a7

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
@@ -240,7 +241,10 @@ protected function loadOptions(array $options)
240241
*/
241242
protected function getSlowThreshold(TestCase $test): int
242243
{
243-
$ann = $test->getAnnotations();
244+
$ann = TestUtil::parseTestMethodAnnotations(
245+
get_class($test),
246+
$test->getName(false)
247+
);
244248

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

0 commit comments

Comments
 (0)