diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index d3e82644..4af6ef56 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -60,6 +60,31 @@
$reporter
+
+
+ sleepWithAfterAnnotation
+
+
+
+
+ sleepWithAfterAnnotation
+
+
+
+
+ sleepWithAfterAnnotation
+
+
+
+
+ sleepWithAfterAnnotation
+
+
+
+
+ sleepWithAfterAnnotation
+
+
provideMillisecondsGreaterThanDefaultMaximumDuration
@@ -83,6 +108,20 @@
provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ sleepWithAfterAnnotation
+ sleepWithAfterAttribute
+
+
+
+
+ provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ sleepWithAfterAnnotation
+
+
+
+
+ provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ sleepWithAfterAttribute
@@ -120,6 +159,18 @@
provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+
+
+ sleepWithAfterAnnotation
+ sleepWithAfterAttribute
+
+
+
+
+ sleepWithAfterAnnotation
+ sleepWithAfterAttribute
+
+
provideMillisecondsGreaterThanDefaultMaximumDuration
@@ -143,6 +194,13 @@
provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ sleepWithAfterAttribute
+
+
+
+
+ provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ sleepWithAfterAttribute
@@ -180,6 +238,11 @@
provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+
+
+ sleepWithAfterAttribute
+
+
milliseconds * 1000]]>
diff --git a/test/EndToEnd/Version08/TestCase/Combination/SleeperTest.php b/test/EndToEnd/Version08/TestCase/Combination/SleeperTest.php
index efbffb5f..96db98e1 100644
--- a/test/EndToEnd/Version08/TestCase/Combination/SleeperTest.php
+++ b/test/EndToEnd/Version08/TestCase/Combination/SleeperTest.php
@@ -51,6 +51,14 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version08/TestCase/Combination/test.phpt b/test/EndToEnd/Version08/TestCase/Combination/test.phpt
index a9be105f..7a8b8d54 100644
--- a/test/EndToEnd/Version08/TestCase/Combination/test.phpt
+++ b/test/EndToEnd/Version08/TestCase/Combination/test.phpt
@@ -24,9 +24,9 @@ Random %seed: %s
Detected 3 tests that took longer than expected.
-1. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1 (300)
-2. 0.6%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0 (200)
-3. 0.4%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration
+1. 0.8%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1 (300)
+2. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0 (200)
+3. 0.5%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestCase\Combination\SleeperTest::testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration
Time: %s, Memory: %s
diff --git a/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/SleeperTest.php b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/SleeperTest.php
new file mode 100644
index 00000000..c1a067e8
--- /dev/null
+++ b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/SleeperTest.php
@@ -0,0 +1,72 @@
+sleep();
+ }
+
+ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
+ {
+ $milliseconds = 10;
+
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ */
+ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
+ {
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @return \Generator
+ */
+ public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
+ {
+ $values = \range(
+ 200,
+ 300,
+ 100,
+ );
+
+ foreach ($values as $value) {
+ yield $value => [
+ $value,
+ ];
+ }
+ }
+}
diff --git a/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/phpunit.xml b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/phpunit.xml
new file mode 100644
index 00000000..bc5aa998
--- /dev/null
+++ b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/phpunit.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/test.phpt b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/test.phpt
new file mode 100644
index 00000000..cea32841
--- /dev/null
+++ b/test/EndToEnd/Version08/TestCase/WithAfterAnnotation/test.phpt
@@ -0,0 +1,33 @@
+--TEST--
+With a test case that sleeps in a method with @after annotation
+--FILE--
+sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version08/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt b/test/EndToEnd/Version08/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
index acee3915..601cf1aa 100644
--- a/test/EndToEnd/Version08/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
+++ b/test/EndToEnd/Version08/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
@@ -29,10 +29,10 @@ Random %seed: %s
Detected 4 tests that took longer than expected.
-1. 0.9%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
-2. 0.6%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
-3. 0.6%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfiguration
-4. 0.4%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration
+1. 1.0%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
+2. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
+3. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfiguration
+4. 0.5%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration
Time: %s, Memory: %s
diff --git a/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/SleeperTest.php b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/SleeperTest.php
new file mode 100644
index 00000000..49149c1a
--- /dev/null
+++ b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/SleeperTest.php
@@ -0,0 +1,72 @@
+sleep();
+ }
+
+ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
+ {
+ $milliseconds = 10;
+
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
+ */
+ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
+ {
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @return \Generator
+ */
+ public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
+ {
+ $values = \range(
+ 200,
+ 300,
+ 100,
+ );
+
+ foreach ($values as $value) {
+ yield $value => [
+ $value,
+ ];
+ }
+ }
+}
diff --git a/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/phpunit.xml b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/phpunit.xml
new file mode 100644
index 00000000..be45008c
--- /dev/null
+++ b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/phpunit.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/test.phpt b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/test.phpt
new file mode 100644
index 00000000..53bf7e67
--- /dev/null
+++ b/test/EndToEnd/Version09/TestCase/WithAfterAnnotation/test.phpt
@@ -0,0 +1,33 @@
+--TEST--
+With a test case that sleeps in a method with @after annotation
+--FILE--
+sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version09/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt b/test/EndToEnd/Version09/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
index b87dde7e..a75f37d0 100644
--- a/test/EndToEnd/Version09/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
+++ b/test/EndToEnd/Version09/TestMethod/WithRunInSeparateProcessAnnotation/test.phpt
@@ -29,10 +29,10 @@ Random %seed: %s
Detected 4 tests that took longer than expected.
-1. 0.9%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
-2. 0.6%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
-3. 0.6%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfiguration
-4. 0.4%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration
+1. 1.0%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
+2. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfigurationWhenMethodHasRunInSeparateProcessAnnotation
+3. 0.7%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfiguration
+4. 0.5%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithRunInSeparateProcessAnnotation\SleeperTest::testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration
Time: %s, Memory: %s
diff --git a/test/EndToEnd/Version10/TestCase/Combination/SleeperTest.php b/test/EndToEnd/Version10/TestCase/Combination/SleeperTest.php
index b438e772..217cca46 100644
--- a/test/EndToEnd/Version10/TestCase/Combination/SleeperTest.php
+++ b/test/EndToEnd/Version10/TestCase/Combination/SleeperTest.php
@@ -49,6 +49,20 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
+ #[Framework\Attributes\After]
+ public function sleepWithAfterAttribute(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/SleeperTest.php b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/SleeperTest.php
new file mode 100644
index 00000000..2819cfa7
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/SleeperTest.php
@@ -0,0 +1,68 @@
+sleep();
+ }
+
+ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
+ {
+ $milliseconds = 10;
+
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ #[Framework\Attributes\DataProvider('provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration')]
+ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
+ {
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @return \Generator
+ */
+ public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
+ {
+ $values = \range(
+ 200,
+ 300,
+ 100,
+ );
+
+ foreach ($values as $value) {
+ yield $value => [
+ $value,
+ ];
+ }
+ }
+}
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/phpunit.xml b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/phpunit.xml
new file mode 100644
index 00000000..caa0be0e
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/phpunit.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/test.phpt b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/test.phpt
new file mode 100644
index 00000000..b1b646bb
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAnnotation/test.phpt
@@ -0,0 +1,34 @@
+--TEST--
+With a test case that sleeps in a method with @after annotation
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+PHPUnit %s
+
+Runtime: %s
+Configuration: %s/EndToEnd/Version10/TestCase/WithAfterAnnotation/phpunit.xml
+Random %seed: %s
+
+... 3 / 3 (100%)
+
+Detected 2 tests that took longer than expected.
+
+1. 0.3%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestCase\WithAfterAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#1
+2. 0.2%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestCase\WithAfterAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#0
+
+Time: %s, Memory: %s
+
+OK (3 tests, 3 assertions)
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAttribute/SleeperTest.php b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/SleeperTest.php
new file mode 100644
index 00000000..d8edab5a
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/SleeperTest.php
@@ -0,0 +1,66 @@
+sleep();
+ }
+
+ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
+ {
+ $milliseconds = 10;
+
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ #[Framework\Attributes\DataProvider('provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration')]
+ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
+ {
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @return \Generator
+ */
+ public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
+ {
+ $values = \range(
+ 200,
+ 300,
+ 100,
+ );
+
+ foreach ($values as $value) {
+ yield $value => [
+ $value,
+ ];
+ }
+ }
+}
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAttribute/phpunit.xml b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/phpunit.xml
new file mode 100644
index 00000000..caa0be0e
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/phpunit.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version10/TestCase/WithAfterAttribute/test.phpt b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/test.phpt
new file mode 100644
index 00000000..d7742262
--- /dev/null
+++ b/test/EndToEnd/Version10/TestCase/WithAfterAttribute/test.phpt
@@ -0,0 +1,34 @@
+--TEST--
+With a test case that sleeps in a method with After attribute
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+PHPUnit %s
+
+Runtime: %s
+Configuration: %s/EndToEnd/Version10/TestCase/WithAfterAttribute/phpunit.xml
+Random %seed: %s
+
+... 3 / 3 (100%)
+
+Detected 2 tests that took longer than expected.
+
+1. 0.3%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestCase\WithAfterAttribute\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#1
+2. 0.2%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestCase\WithAfterAttribute\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#0
+
+Time: %s, Memory: %s
+
+OK (3 tests, 3 assertions)
diff --git a/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAnnotation/SleeperTest.php b/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAnnotation/SleeperTest.php
index 242aa724..c5ac1032 100644
--- a/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAnnotation/SleeperTest.php
+++ b/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAnnotation/SleeperTest.php
@@ -49,6 +49,20 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
+ #[Framework\Attributes\After]
+ public function sleepWithAfterAttribute(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php b/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
index 3e5ad6b8..6d7c46b5 100644
--- a/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
+++ b/test/EndToEnd/Version10/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
@@ -49,6 +49,20 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ /**
+ * @after
+ */
+ public function sleepWithAfterAnnotation(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
+ #[Framework\Attributes\After]
+ public function sleepWithAfterAttribute(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version11/TestCase/Combination/SleeperTest.php b/test/EndToEnd/Version11/TestCase/Combination/SleeperTest.php
index 684ebe25..00bd09c6 100644
--- a/test/EndToEnd/Version11/TestCase/Combination/SleeperTest.php
+++ b/test/EndToEnd/Version11/TestCase/Combination/SleeperTest.php
@@ -49,6 +49,12 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ #[Framework\Attributes\After]
+ public function sleepWithAfterAttribute(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 10;
diff --git a/test/EndToEnd/Version11/TestCase/WithAfterAttribute/SleeperTest.php b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/SleeperTest.php
new file mode 100644
index 00000000..dac137e5
--- /dev/null
+++ b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/SleeperTest.php
@@ -0,0 +1,66 @@
+sleep();
+ }
+
+ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
+ {
+ $milliseconds = 10;
+
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ #[Framework\Attributes\DataProvider('provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration')]
+ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
+ {
+ $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
+
+ $sleeper->sleep();
+
+ self::assertSame($milliseconds, $sleeper->milliseconds());
+ }
+
+ /**
+ * @return \Generator
+ */
+ public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
+ {
+ $values = \range(
+ 200,
+ 300,
+ 100,
+ );
+
+ foreach ($values as $value) {
+ yield $value => [
+ $value,
+ ];
+ }
+ }
+}
diff --git a/test/EndToEnd/Version11/TestCase/WithAfterAttribute/phpunit.xml b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/phpunit.xml
new file mode 100644
index 00000000..60983aad
--- /dev/null
+++ b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/phpunit.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+ .
+
+
+
diff --git a/test/EndToEnd/Version11/TestCase/WithAfterAttribute/test.phpt b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/test.phpt
new file mode 100644
index 00000000..dbef87db
--- /dev/null
+++ b/test/EndToEnd/Version11/TestCase/WithAfterAttribute/test.phpt
@@ -0,0 +1,34 @@
+--TEST--
+With a test case that sleeps in a method with After attribute
+--FILE--
+run($_SERVER['argv']);
+--EXPECTF--
+PHPUnit %s
+
+Runtime: %s
+Configuration: %s/EndToEnd/Version11/TestCase/WithAfterAttribute/phpunit.xml
+Random %seed: %s
+
+... 3 / 3 (100%)
+
+Detected 2 tests that took longer than expected.
+
+1. 0.3%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version11\TestCase\WithAfterAttribute\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#1
+2. 0.2%s (0.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version11\TestCase\WithAfterAttribute\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider#0
+
+Time: %s, Memory: %s
+
+OK (3 tests, 3 assertions)
diff --git a/test/EndToEnd/Version11/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php b/test/EndToEnd/Version11/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
index 711fefa6..479ed226 100644
--- a/test/EndToEnd/Version11/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
+++ b/test/EndToEnd/Version11/TestMethod/WithRunInSeparateProcessAttribute/SleeperTest.php
@@ -49,6 +49,12 @@ protected function tearDown(): void
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}
+ #[Framework\Attributes\After]
+ public function sleepWithAfterAttribute(): void
+ {
+ Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
+ }
+
public function testSleeperSleepsShorterThanMaximumDurationFromXmlConfiguration(): void
{
$milliseconds = 50;