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; }