diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92a9d77a..3ff55eb1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
For a full diff see [`2.19.1...main`][2.19.1...main].
+### Fixed
+
+- Fixed discovery of `@maximumDuration` annotation when a test case does not have any test methods ([#687]), by [@courtney-miles]
+
## [`2.19.1`][2.19.1]
For a full diff see [`2.19.0...2.19.1`][2.19.0...2.19.1].
@@ -413,6 +417,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
[#664]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/664
[@dantleech]: https://github.com/dantleech
+[@courtney-miles]: https://github.com/courtney-miles
[@HypeMC]: https://github.com/HypeMC
[@localheinz]: https://github.com/localheinz
[@morgan-atproperties]: https://github.com/morgan-atproperties
diff --git a/src/Extension.php b/src/Extension.php
index d753042e..03782540 100644
--- a/src/Extension.php
+++ b/src/Extension.php
@@ -371,6 +371,10 @@ private function resolveMaximumDuration(string $test): MaximumDuration
);
}
+ if (\strpos($test, '::') === false) {
+ return $this->maximumDuration;
+ }
+
list($testClassName, $testMethodName) = \explode(
'::',
$test
diff --git a/test/EndToEnd/Version06/TestCase/WithoutTestMethods/SleeperTest.php b/test/EndToEnd/Version06/TestCase/WithoutTestMethods/SleeperTest.php
new file mode 100644
index 00000000..52eff51e
--- /dev/null
+++ b/test/EndToEnd/Version06/TestCase/WithoutTestMethods/SleeperTest.php
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version06/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version06/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..267931ce
--- /dev/null
+++ b/test/EndToEnd/Version06/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,20 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version07/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version07/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..d0002455
--- /dev/null
+++ b/test/EndToEnd/Version07/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,20 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version08/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version08/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..3706c358
--- /dev/null
+++ b/test/EndToEnd/Version08/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,20 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version09/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version09/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..25095267
--- /dev/null
+++ b/test/EndToEnd/Version09/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,20 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version10/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version10/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..93985332
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,24 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+%a
+
+There was 1 PHPUnit%swarning:
+
+1) No tests found in class "Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestCase\WithoutTestMethods\SleeperTest".
+
+No tests executed!
diff --git a/test/EndToEnd/Version11/TestCase/WithoutTestMethods/SleeperTest.php b/test/EndToEnd/Version11/TestCase/WithoutTestMethods/SleeperTest.php
new file mode 100644
index 00000000..724f4ef9
--- /dev/null
+++ b/test/EndToEnd/Version11/TestCase/WithoutTestMethods/SleeperTest.php
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version11/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version11/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..82e38596
--- /dev/null
+++ b/test/EndToEnd/Version11/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,24 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+%a
+
+There was 1 PHPUnit test runner warning:
+
+1) No tests found in class "Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version11\TestCase\WithoutTestMethods\SleeperTest".
+
+No tests executed!
diff --git a/test/EndToEnd/Version12/TestCase/WithoutTestMethods/SleeperTest.php b/test/EndToEnd/Version12/TestCase/WithoutTestMethods/SleeperTest.php
new file mode 100644
index 00000000..2aafc1b6
--- /dev/null
+++ b/test/EndToEnd/Version12/TestCase/WithoutTestMethods/SleeperTest.php
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version12/TestCase/WithoutTestMethods/test.phpt b/test/EndToEnd/Version12/TestCase/WithoutTestMethods/test.phpt
new file mode 100644
index 00000000..b55f3a1a
--- /dev/null
+++ b/test/EndToEnd/Version12/TestCase/WithoutTestMethods/test.phpt
@@ -0,0 +1,24 @@
+--TEST--
+With a test case that has no test methods
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+%a
+
+There was 1 PHPUnit test runner warning:
+
+1) No tests found in class "Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version12\TestCase\WithoutTestMethods\SleeperTest".
+
+No tests executed!