diff --git a/test/EndToEnd/Version10/DefaultConfiguration/SleeperTest.php b/test/EndToEnd/Version10/DefaultConfiguration/SleeperTest.php index e094eb80..4bc259b1 100644 --- a/test/EndToEnd/Version10/DefaultConfiguration/SleeperTest.php +++ b/test/EndToEnd/Version10/DefaultConfiguration/SleeperTest.php @@ -359,4 +359,32 @@ public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): i ]; } } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsShorterThanDefaultMaximumDuration(): void + { + $milliseconds = 50; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration(): void + { + $milliseconds = 750; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } } diff --git a/test/EndToEnd/Version10/DefaultConfiguration/test.phpt b/test/EndToEnd/Version10/DefaultConfiguration/test.phpt index 4172fa11..0a24f6a3 100644 --- a/test/EndToEnd/Version10/DefaultConfiguration/test.phpt +++ b/test/EndToEnd/Version10/DefaultConfiguration/test.phpt @@ -9,7 +9,9 @@ use PHPUnit\TextUI; $_SERVER['argv'][] = '--configuration=test/EndToEnd/Version10/DefaultConfiguration/phpunit.xml'; -require_once __DIR__ . '/../../../../vendor/autoload.php'; +define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/../../../../vendor/autoload.php'); + +require_once PHPUNIT_COMPOSER_INSTALL; $application = new TextUI\Application(); @@ -21,23 +23,23 @@ Runtime: %s Configuration: %Stest/EndToEnd/Version10/DefaultConfiguration/phpunit.xml Random %seed: %s -....................... 23 / 23 (100%) +......................... 25 / 25 (100%) -Detected 13 tests that took longer than expected. +Detected 14 tests that took longer than expected. 1. 1.30%s (1.150) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAttributeWithValidMaximumDurationAndSlowThresholdAnnotation 2. 1.25%s (1.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAttribute 3. 1.20%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidSlowThresholdAndMaximumDurationAnnotation 4. 1.15%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAndSlowThresholdAnnotation 5. 1.10%s (0.900) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanSlowThresholdFromAnnotationWithValidSlowThresholdAnnotation - 6. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation - 7. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation - 8. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation - 9. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock -10. 0.85%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration + 6. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration + 7. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation + 8. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation + 9. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation +10. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock -There are 3 additional slow tests that are not listed here. +There are 4 additional slow tests that are not listed here. Time: %s, Memory: %s -OK (23 tests, 23 assertions) +OK (25 tests, 25 assertions) diff --git a/test/EndToEnd/Version8/DefaultConfiguration/SleeperTest.php b/test/EndToEnd/Version8/DefaultConfiguration/SleeperTest.php index db88730e..3ac4bc78 100644 --- a/test/EndToEnd/Version8/DefaultConfiguration/SleeperTest.php +++ b/test/EndToEnd/Version8/DefaultConfiguration/SleeperTest.php @@ -304,4 +304,32 @@ public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): i ]; } } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsShorterThanDefaultMaximumDuration(): void + { + $milliseconds = 50; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration(): void + { + $milliseconds = 750; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } } diff --git a/test/EndToEnd/Version8/DefaultConfiguration/test.phpt b/test/EndToEnd/Version8/DefaultConfiguration/test.phpt index 64cf95d0..38e56850 100644 --- a/test/EndToEnd/Version8/DefaultConfiguration/test.phpt +++ b/test/EndToEnd/Version8/DefaultConfiguration/test.phpt @@ -9,7 +9,9 @@ use PHPUnit\TextUI; $_SERVER['argv'][] = '--configuration=test/EndToEnd/Version8/DefaultConfiguration/phpunit.xml'; -require_once __DIR__ . '/../../../../vendor/autoload.php'; +define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/../../../../vendor/autoload.php'); + +require_once PHPUNIT_COMPOSER_INSTALL; PHPUnit\TextUI\Command::main(); --EXPECTF-- @@ -19,23 +21,23 @@ Runtime: %s Configuration: %Stest/EndToEnd/Version8/DefaultConfiguration/phpunit.xml Random %seed: %s -................... 19 / 19 (100%) +..................... 21 / 21 (100%) -Detected 11 tests that took longer than expected. +Detected 12 tests that took longer than expected. 1. 1.20%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidSlowThresholdAndMaximumDurationAnnotation 2. 1.15%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAndSlowThresholdAnnotation 3. 1.10%s (0.900) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanSlowThresholdFromAnnotationWithValidSlowThresholdAnnotation - 4. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation - 5. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation - 6. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation - 7. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock - 8. 0.85%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration - 9. 0.70%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (600) -10. 0.65%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (550) + 4. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration + 5. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation + 6. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation + 7. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation + 8. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock + 9. 0.85%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration +10. 0.70%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (600) -There is 1 additional slow test that is not listed here. +There are 2 additional slow tests that are not listed here. Time: %s, Memory: %s -OK (19 tests, 19 assertions) +OK (21 tests, 21 assertions) diff --git a/test/EndToEnd/Version9/DefaultConfiguration/SleeperTest.php b/test/EndToEnd/Version9/DefaultConfiguration/SleeperTest.php index 1dcbc408..857837b8 100644 --- a/test/EndToEnd/Version9/DefaultConfiguration/SleeperTest.php +++ b/test/EndToEnd/Version9/DefaultConfiguration/SleeperTest.php @@ -304,4 +304,32 @@ public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): i ]; } } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsShorterThanDefaultMaximumDuration(): void + { + $milliseconds = 50; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } + + /** + * @runInSeparateProcess + */ + public function testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration(): void + { + $milliseconds = 750; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } } diff --git a/test/EndToEnd/Version9/DefaultConfiguration/test.phpt b/test/EndToEnd/Version9/DefaultConfiguration/test.phpt index 5f35cb6d..868cb8c7 100644 --- a/test/EndToEnd/Version9/DefaultConfiguration/test.phpt +++ b/test/EndToEnd/Version9/DefaultConfiguration/test.phpt @@ -9,7 +9,9 @@ use PHPUnit\TextUI; $_SERVER['argv'][] = '--configuration=test/EndToEnd/Version9/DefaultConfiguration/phpunit.xml'; -require_once __DIR__ . '/../../../../vendor/autoload.php'; +define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/../../../../vendor/autoload.php'); + +require_once PHPUNIT_COMPOSER_INSTALL; PHPUnit\TextUI\Command::main(); --EXPECTF-- @@ -19,23 +21,23 @@ Runtime: %s Configuration: %Stest/EndToEnd/Version9/DefaultConfiguration/phpunit.xml Random %seed: %s -................... 19 / 19 (100%) +..................... 21 / 21 (100%) -Detected 11 tests that took longer than expected. +Detected 12 tests that took longer than expected. 1. 1.20%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidSlowThresholdAndMaximumDurationAnnotation 2. 1.15%s (1.000) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAndSlowThresholdAnnotation 3. 1.10%s (0.900) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanSlowThresholdFromAnnotationWithValidSlowThresholdAnnotation - 4. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation - 5. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation - 6. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation - 7. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock - 8. 0.85%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration - 9. 0.70%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (600) -10. 0.65%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (550) + 4. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testRunInSeparateProcessSleeperSleepsLongerThanDefaultMaximumDuration + 5. 1.05%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidSlowThresholdAnnotation + 6. 1.00%s (0.800) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWithValidMaximumDurationAnnotation + 7. 0.95%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithInvalidMaximumDurationAnnotation + 8. 0.90%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithUselessDocBlock + 9. 0.85%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration +10. 0.70%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version9\DefaultConfiguration\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (600) -There is 1 additional slow test that is not listed here. +There are 2 additional slow tests that are not listed here. Time: %s, Memory: %s -OK (19 tests, 19 assertions) +OK (21 tests, 21 assertions)