From 2b196cfa000ae6d0c9f0b83c3860375bd4da0e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 4 Dec 2020 11:31:14 +0100 Subject: [PATCH] Fix for PHPUnit 9.5 and newer --- src/SpeedTrapListener.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SpeedTrapListener.php b/src/SpeedTrapListener.php index dcf0a1f..097d777 100644 --- a/src/SpeedTrapListener.php +++ b/src/SpeedTrapListener.php @@ -4,6 +4,7 @@ namespace JohnKary\PHPUnit\Listener; use PHPUnit\Framework\{TestListener, TestListenerDefaultImplementation, TestSuite, Test, TestCase}; +use PHPUnit\Util\Test as TestUtil; /** * A PHPUnit TestListener that exposes your slowest running tests by outputting @@ -222,7 +223,10 @@ protected function loadOptions(array $options) */ protected function getSlowThreshold(TestCase $test): int { - $ann = $test->getAnnotations(); + $ann = TestUtil::parseTestMethodAnnotations( + get_class($test), + $test->getName(false) + ); return isset($ann['method']['slowThreshold'][0]) ? (int) $ann['method']['slowThreshold'][0] : $this->slowThreshold; }