Skip to content

Commit

Permalink
Merge pull request #399 from ergebnis/fix/reduce
Browse files Browse the repository at this point in the history
Fix: Reduce number of tests
  • Loading branch information
localheinz authored Dec 4, 2023
2 parents f15fa27 + b94d7f2 commit d7ff0df
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 517 deletions.
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
<code>provideMillisecondsGreaterThanDefaultMaximumDuration</code>
</PossiblyUnusedMethod>
</file>
<file src="test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php">
<PossiblyUnusedMethod>
<code>provideMillisecondsGreaterThanDefaultMaximumDuration</code>
</PossiblyUnusedMethod>
</file>
<file src="test/Fixture/Sleeper.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->milliseconds * 1000]]></code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="../../../../../vendor/autoload.php"
bootstrap="../../../../vendor/autoload.php"
cacheResult="false"
colors="true"
columns="max"
Expand All @@ -17,6 +17,7 @@
>
<extensions>
<bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension">
<parameter name="maximum-count" value="3"/>
<parameter name="maximum-duration" value="50"/>
</bootstrap>
</extensions>
Expand Down
36 changes: 36 additions & 0 deletions test/EndToEnd/Version10/CustomConfiguration/test.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
Configuring "maximum-count" parameter to 3 and "maximum-duration" parameter to 50 milliseconds
--FILE--
<?php

declare(strict_types=1);

use PHPUnit\TextUI;

$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version10/CustomConfiguration/phpunit.xml';

require_once __DIR__ . '/../../../../vendor/autoload.php';

$application = new TextUI\Application();

$application->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)
62 changes: 0 additions & 62 deletions test/EndToEnd/Version10/MaximumCount/Three/SleeperTest.php

This file was deleted.

28 changes: 0 additions & 28 deletions test/EndToEnd/Version10/MaximumCount/Three/phpunit.xml

This file was deleted.

36 changes: 0 additions & 36 deletions test/EndToEnd/Version10/MaximumCount/Three/test.phpt

This file was deleted.

38 changes: 0 additions & 38 deletions test/EndToEnd/Version10/MaximumDuration/Fifty/test.phpt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="../../../../../vendor/autoload.php"
bootstrap="../../../../vendor/autoload.php"
cacheResult="false"
colors="true"
columns="max"
Expand All @@ -21,6 +21,9 @@
<extension class="Ergebnis\PHPUnit\SlowTestDetector\Extension">
<arguments>
<array>
<element key="maximum-count">
<integer>3</integer>
</element>
<element key="maximum-duration">
<integer>50</integer>
</element>
Expand Down
34 changes: 34 additions & 0 deletions test/EndToEnd/Version8/CustomConfiguration/test.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--TEST--
Configuring "maximum-count" parameter to 3 and "maximum-duration" parameter to 50 milliseconds
--FILE--
<?php

declare(strict_types=1);

use PHPUnit\TextUI;

$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version8/CustomConfiguration/phpunit.xml';

require_once __DIR__ . '/../../../../vendor/autoload.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s

Runtime: %s
Configuration: %Stest/EndToEnd/Version8/CustomConfiguration/phpunit.xml
Random %seed: %s

.......... 10 / 10 (100%)

Detected 6 tests that took longer than expected.

1. 0.2%s (0.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromSlowThresholdAnnotation
2. 0.2%s (0.180) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentBeforeMaximumDuration
3. 0.1%s (0.160) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\CustomConfiguration\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromMaximumDurationAnnotationWhenSlowThresholdAnnotationIsPresentAfterMaximumDuration

There are 3 additional slow tests that are not listed here.

Time: %s, Memory: %s

OK (10 tests, 10 assertions)
66 changes: 0 additions & 66 deletions test/EndToEnd/Version8/MaximumCount/Three/SleeperTest.php

This file was deleted.

Loading

0 comments on commit d7ff0df

Please sign in to comment.