From 84f6e8f0a47bfa4504e2c2eed0730d9cc439e692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 4 Dec 2023 11:05:22 +0100 Subject: [PATCH] Fix: Reduce number of tests --- psalm-baseline.xml | 5 -- .../SleeperTest.php | 2 +- .../Fifty => CustomConfiguration}/phpunit.xml | 3 +- .../Version10/CustomConfiguration/test.phpt | 36 ++++++++++ .../MaximumCount/Three/SleeperTest.php | 62 ----------------- .../Version10/MaximumCount/Three/phpunit.xml | 28 -------- .../Version10/MaximumCount/Three/test.phpt | 36 ---------- .../Version10/MaximumDuration/Fifty/test.phpt | 38 ----------- .../CustomConfiguration}/SleeperTest.php | 2 +- .../Fifty => CustomConfiguration}/phpunit.xml | 5 +- .../Version8/CustomConfiguration/test.phpt | 34 ++++++++++ .../MaximumCount/Three/SleeperTest.php | 66 ------------------- .../Version8/MaximumCount/Three/phpunit.xml | 36 ---------- .../Version8/MaximumCount/Three/test.phpt | 34 ---------- .../Version8/MaximumDuration/Fifty/test.phpt | 35 ---------- .../CustomConfiguration}/SleeperTest.php | 2 +- .../Fifty => CustomConfiguration}/phpunit.xml | 5 +- .../Version9/CustomConfiguration/test.phpt | 34 ++++++++++ .../MaximumCount/Three/SleeperTest.php | 66 ------------------- .../Version9/MaximumCount/Three/phpunit.xml | 36 ---------- .../Version9/MaximumCount/Three/test.phpt | 34 ---------- .../Version9/MaximumDuration/Fifty/test.phpt | 35 ---------- 22 files changed, 117 insertions(+), 517 deletions(-) rename test/EndToEnd/Version10/{MaximumDuration/Fifty => CustomConfiguration}/SleeperTest.php (99%) rename test/EndToEnd/Version10/{MaximumDuration/Fifty => CustomConfiguration}/phpunit.xml (89%) create mode 100644 test/EndToEnd/Version10/CustomConfiguration/test.phpt delete mode 100644 test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php delete mode 100644 test/EndToEnd/Version10/MaximumCount/Three/phpunit.xml delete mode 100644 test/EndToEnd/Version10/MaximumCount/Three/test.phpt delete mode 100644 test/EndToEnd/Version10/MaximumDuration/Fifty/test.phpt rename test/EndToEnd/{Version9/MaximumDuration/Fifty => Version8/CustomConfiguration}/SleeperTest.php (99%) rename test/EndToEnd/Version8/{MaximumDuration/Fifty => CustomConfiguration}/phpunit.xml (86%) create mode 100644 test/EndToEnd/Version8/CustomConfiguration/test.phpt delete mode 100644 test/EndToEnd/Version8/MaximumCount/Three/SleeperTest.php delete mode 100644 test/EndToEnd/Version8/MaximumCount/Three/phpunit.xml delete mode 100644 test/EndToEnd/Version8/MaximumCount/Three/test.phpt delete mode 100644 test/EndToEnd/Version8/MaximumDuration/Fifty/test.phpt rename test/EndToEnd/{Version8/MaximumDuration/Fifty => Version9/CustomConfiguration}/SleeperTest.php (99%) rename test/EndToEnd/Version9/{MaximumDuration/Fifty => CustomConfiguration}/phpunit.xml (86%) create mode 100644 test/EndToEnd/Version9/CustomConfiguration/test.phpt delete mode 100644 test/EndToEnd/Version9/MaximumCount/Three/SleeperTest.php delete mode 100644 test/EndToEnd/Version9/MaximumCount/Three/phpunit.xml delete mode 100644 test/EndToEnd/Version9/MaximumCount/Three/test.phpt delete mode 100644 test/EndToEnd/Version9/MaximumDuration/Fifty/test.phpt diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 5bb152a6..77d67881 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -80,11 +80,6 @@ provideMillisecondsGreaterThanDefaultMaximumDuration - - - provideMillisecondsGreaterThanDefaultMaximumDuration - - milliseconds * 1000]]> diff --git a/test/EndToEnd/Version10/MaximumDuration/Fifty/SleeperTest.php b/test/EndToEnd/Version10/CustomConfiguration/SleeperTest.php similarity index 99% rename from test/EndToEnd/Version10/MaximumDuration/Fifty/SleeperTest.php rename to test/EndToEnd/Version10/CustomConfiguration/SleeperTest.php index 3db3e29e..3a68eeb9 100644 --- a/test/EndToEnd/Version10/MaximumDuration/Fifty/SleeperTest.php +++ b/test/EndToEnd/Version10/CustomConfiguration/SleeperTest.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/phpunit-slow-test-detector */ -namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty; +namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\CustomConfiguration; use Ergebnis\PHPUnit\SlowTestDetector\Attribute; use Ergebnis\PHPUnit\SlowTestDetector\Test; diff --git a/test/EndToEnd/Version10/MaximumDuration/Fifty/phpunit.xml b/test/EndToEnd/Version10/CustomConfiguration/phpunit.xml similarity index 89% rename from test/EndToEnd/Version10/MaximumDuration/Fifty/phpunit.xml rename to test/EndToEnd/Version10/CustomConfiguration/phpunit.xml index 74815eaa..a7b73a73 100644 --- a/test/EndToEnd/Version10/MaximumDuration/Fifty/phpunit.xml +++ b/test/EndToEnd/Version10/CustomConfiguration/phpunit.xml @@ -5,7 +5,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" - bootstrap="../../../../../vendor/autoload.php" + bootstrap="../../../../vendor/autoload.php" cacheResult="false" colors="true" columns="max" @@ -17,6 +17,7 @@ > + diff --git a/test/EndToEnd/Version10/CustomConfiguration/test.phpt b/test/EndToEnd/Version10/CustomConfiguration/test.phpt new file mode 100644 index 00000000..2113457e --- /dev/null +++ b/test/EndToEnd/Version10/CustomConfiguration/test.phpt @@ -0,0 +1,36 @@ +--TEST-- +Configuring "maximum-duration" parameter to 50 milliseconds +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit %s + +Runtime: %s +Configuration: %Stest/EndToEnd/Version10/CustomConfiguration/phpunit.xml +Random %seed: %s + +............. 13 / 13 (100%) + +Detected 7 tests that took longer than expected. + +1. 0.2%s (0.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromSlowThresholdAnnotation +2. 0.2%s (0.180) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentBeforeMaximumDuration +3. 0.1%s (0.160) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentAfterMaximumDuration + +There are 4 additional slow tests that are not listed here. + +Time: %s, Memory: %s + +OK (13 tests, 13 assertions) diff --git a/test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php b/test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php deleted file mode 100644 index d2323fdf..00000000 --- a/test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php +++ /dev/null @@ -1,62 +0,0 @@ -sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - #[Framework\Attributes\DataProvider('provideMillisecondsGreaterThanDefaultMaximumDuration')] - public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void - { - $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); - - $sleeper->sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - /** - * @return \Generator - */ - public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): \Generator - { - $values = \range( - 550, - 700, - 50, - ); - - foreach ($values as $value) { - yield $value => [ - $value, - ]; - } - } -} diff --git a/test/EndToEnd/Version10/MaximumCount/Three/phpunit.xml b/test/EndToEnd/Version10/MaximumCount/Three/phpunit.xml deleted file mode 100644 index f860d73d..00000000 --- a/test/EndToEnd/Version10/MaximumCount/Three/phpunit.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - . - - - diff --git a/test/EndToEnd/Version10/MaximumCount/Three/test.phpt b/test/EndToEnd/Version10/MaximumCount/Three/test.phpt deleted file mode 100644 index 8b747822..00000000 --- a/test/EndToEnd/Version10/MaximumCount/Three/test.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Configuring "maximum-duration" parameter to 50 milliseconds ---FILE-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s - -Runtime: %s -Configuration: %Stest/EndToEnd/Version10/MaximumCount/Three/phpunit.xml -Random %seed: %s - -..... 5 / 5 (100%) - -Detected 4 tests that took longer than expected. - -1. 0.7%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumCount\Three\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#3 -2. 0.6%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumCount\Three\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#2 -3. 0.6%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumCount\Three\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#1 - -There is 1 additional slow test that is not listed here. - -Time: %s, Memory: %s - -OK (5 tests, 5 assertions) diff --git a/test/EndToEnd/Version10/MaximumDuration/Fifty/test.phpt b/test/EndToEnd/Version10/MaximumDuration/Fifty/test.phpt deleted file mode 100644 index 4d200a1c..00000000 --- a/test/EndToEnd/Version10/MaximumDuration/Fifty/test.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Configuring "maximum-duration" parameter to 50 milliseconds ---FILE-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s - -Runtime: %s -Configuration: %Stest/EndToEnd/Version10/MaximumDuration/Fifty/phpunit.xml -Random %seed: %s - -............. 13 / 13 (100%) - -Detected 7 tests that took longer than expected. - -1. 0.2%s (0.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromSlowThresholdAnnotation -2. 0.2%s (0.180) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentBeforeMaximumDuration -3. 0.1%s (0.160) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentAfterMaximumDuration -4. 0.1%s (0.160) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAttribute -5. 0.1%s (0.150) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotation -6. 0.1%s (0.050) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsWithDocBlockWithMaximumDurationAnnotationWhereValueIsNotAnInt -7. 0.0%s (0.050) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\MaximumDuration\Fifty\SleeperTest::testSleeperSleepsWithDocBlockWithoutSlowThresholdAnnotation - -Time: %s, Memory: %s - -OK (13 tests, 13 assertions) diff --git a/test/EndToEnd/Version9/MaximumDuration/Fifty/SleeperTest.php b/test/EndToEnd/Version8/CustomConfiguration/SleeperTest.php similarity index 99% rename from test/EndToEnd/Version9/MaximumDuration/Fifty/SleeperTest.php rename to test/EndToEnd/Version8/CustomConfiguration/SleeperTest.php index 4196dc68..de69f863 100644 --- a/test/EndToEnd/Version9/MaximumDuration/Fifty/SleeperTest.php +++ b/test/EndToEnd/Version8/CustomConfiguration/SleeperTest.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/phpunit-slow-test-detector */ -namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\MaximumDuration\Fifty; +namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\CustomConfiguration; use Ergebnis\PHPUnit\SlowTestDetector\Test; use PHPUnit\Framework; diff --git a/test/EndToEnd/Version8/MaximumDuration/Fifty/phpunit.xml b/test/EndToEnd/Version8/CustomConfiguration/phpunit.xml similarity index 86% rename from test/EndToEnd/Version8/MaximumDuration/Fifty/phpunit.xml rename to test/EndToEnd/Version8/CustomConfiguration/phpunit.xml index 371e703a..e9a624cf 100644 --- a/test/EndToEnd/Version8/MaximumDuration/Fifty/phpunit.xml +++ b/test/EndToEnd/Version8/CustomConfiguration/phpunit.xml @@ -5,7 +5,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" - bootstrap="../../../../../vendor/autoload.php" + bootstrap="../../../../vendor/autoload.php" cacheResult="false" colors="true" columns="max" @@ -21,6 +21,9 @@ + + 3 + 50 diff --git a/test/EndToEnd/Version8/CustomConfiguration/test.phpt b/test/EndToEnd/Version8/CustomConfiguration/test.phpt new file mode 100644 index 00000000..8bc62450 --- /dev/null +++ b/test/EndToEnd/Version8/CustomConfiguration/test.phpt @@ -0,0 +1,34 @@ +--TEST-- +Configuring "maximum-duration" parameter to 50 milliseconds +--FILE-- +sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - /** - * @dataProvider provideMillisecondsGreaterThanDefaultMaximumDuration - */ - public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void - { - $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); - - $sleeper->sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - /** - * @return \Generator - */ - public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable - { - $values = \range( - 550, - 700, - 50, - ); - - foreach ($values as $value) { - yield $value => [ - $value, - ]; - } - } -} diff --git a/test/EndToEnd/Version8/MaximumCount/Three/phpunit.xml b/test/EndToEnd/Version8/MaximumCount/Three/phpunit.xml deleted file mode 100644 index 609e2844..00000000 --- a/test/EndToEnd/Version8/MaximumCount/Three/phpunit.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - 3 - - - - - - - - . - - - diff --git a/test/EndToEnd/Version8/MaximumCount/Three/test.phpt b/test/EndToEnd/Version8/MaximumCount/Three/test.phpt deleted file mode 100644 index 03139059..00000000 --- a/test/EndToEnd/Version8/MaximumCount/Three/test.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Configuring "maximum-duration" parameter to 50 milliseconds ---FILE-- - + + 3 + 50 diff --git a/test/EndToEnd/Version9/CustomConfiguration/test.phpt b/test/EndToEnd/Version9/CustomConfiguration/test.phpt new file mode 100644 index 00000000..f6560476 --- /dev/null +++ b/test/EndToEnd/Version9/CustomConfiguration/test.phpt @@ -0,0 +1,34 @@ +--TEST-- +Configuring "maximum-duration" parameter to 50 milliseconds +--FILE-- +sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - /** - * @dataProvider provideMillisecondsGreaterThanDefaultMaximumDuration - */ - public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void - { - $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); - - $sleeper->sleep(); - - self::assertSame($milliseconds, $sleeper->milliseconds()); - } - - /** - * @return \Generator - */ - public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable - { - $values = \range( - 550, - 700, - 50, - ); - - foreach ($values as $value) { - yield $value => [ - $value, - ]; - } - } -} diff --git a/test/EndToEnd/Version9/MaximumCount/Three/phpunit.xml b/test/EndToEnd/Version9/MaximumCount/Three/phpunit.xml deleted file mode 100644 index e1c0feb4..00000000 --- a/test/EndToEnd/Version9/MaximumCount/Three/phpunit.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - 3 - - - - - - - - . - - - diff --git a/test/EndToEnd/Version9/MaximumCount/Three/test.phpt b/test/EndToEnd/Version9/MaximumCount/Three/test.phpt deleted file mode 100644 index 4f52ad71..00000000 --- a/test/EndToEnd/Version9/MaximumCount/Three/test.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Configuring "maximum-duration" parameter to 50 milliseconds ---FILE-- -