Skip to content

Commit

Permalink
Merge pull request #218 from ergebnis/fix/default
Browse files Browse the repository at this point in the history
Fix: Adjust defaults
  • Loading branch information
localheinz authored Feb 10, 2023
2 parents f9d6c1d + 0abc328 commit 28d2040
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For a full diff see [`1.0.0...main`][1.0.0...main].
### Fixed

- Removed possibility to configure maximum count of reported tests using the `MAXIMUM_NUMBER` environment variable ([#211]), by [@localheinz]
- Increased default maximum count from `3` to `10` and default maximum duration from `125` to `500` milliseconds ([#218]), by [@localheinz]

## [`1.0.0`][1.0.0]

Expand Down Expand Up @@ -80,5 +81,6 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
[#211]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/211
[#212]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/212
[#217]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/217
[#218]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/218

[@localheinz]: https://github.com/localheinz
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ To bootstrap the extension, adjust your `phpunit.xml` configuration file:

You can configure the extension with the following parameters in your `phpunit.xml` configuration file:

- `maximum-count`, an `int`, the maximum count of slow test that should be listed, defaults to `3`
- `maximum-duration`, an `int`, the maximum duration in milliseconds for all tests, defaults to `250`
- `maximum-count`, an `int`, the maximum count of slow test that should be listed, defaults to `10`
- `maximum-duration`, an `int`, the maximum duration in milliseconds for all tests, defaults to `500`

The following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds:

Expand Down
4 changes: 2 additions & 2 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public function bootstrap(
Runner\Extension\Facade $facade,
Runner\Extension\ParameterCollection $parameters,
): void {
$maximumCount = MaximumCount::fromInt(3);
$maximumCount = MaximumCount::fromInt(10);

if ($parameters->has('maximum-count')) {
$maximumCount = MaximumCount::fromInt((int) $parameters->get('maximum-count'));
}

$maximumDuration = MaximumDuration::fromMilliseconds(125);
$maximumDuration = MaximumDuration::fromMilliseconds(500);

if ($parameters->has('maximum-duration')) {
$maximumDuration = MaximumDuration::fromMilliseconds((int) $parameters->get('maximum-duration'));
Expand Down
9 changes: 3 additions & 6 deletions test/EndToEnd/MaximumCount/Default/test.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ Random Seed: %s

......... 9 / 9 (100%)

Detected 8 tests that took longer than expected.
Detected 2 tests that took longer than expected.

1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1
4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt

There are 5 additional slow tests that are not listed here.
1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1

Time: %s, Memory: %s

Expand Down
11 changes: 3 additions & 8 deletions test/EndToEnd/MaximumCount/Five/test.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ Random Seed: %s

......... 9 / 9 (100%)

Detected 8 tests that took longer than expected.
Detected 2 tests that took longer than expected.

1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1
4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt
4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithoutSlowThresholdAnnotation
3%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsThreeHundredMilliseconds

There are 3 additional slow tests that are not listed here.
1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1

Time: %s, Memory: %s

Expand Down
9 changes: 3 additions & 6 deletions test/EndToEnd/MaximumDuration/Default/test.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ Random Seed: %s

......... 9 / 9 (100%)

Detected 8 tests that took longer than expected.
Detected 2 tests that took longer than expected.

1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1
4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt

There are 5 additional slow tests that are not listed here.
1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1

Time: %s, Memory: %s

Expand Down
7 changes: 5 additions & 2 deletions test/EndToEnd/MaximumDuration/Fifty/test.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ Detected 8 tests that took longer than expected.
1,0%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond
5%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1
4%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt

There are 5 additional slow tests that are not listed here.
4%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithoutSlowThresholdAnnotation
3%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsThreeHundredMilliseconds
2%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#0
2%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsTwoHundredMilliseconds
1%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneHundredFiftyMilliseconds

Time: %s, Memory: %s

Expand Down

0 comments on commit 28d2040

Please sign in to comment.