generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Add support for phpunit/phpunit:^6.5.0
- Loading branch information
1 parent
f192ad8
commit 210e1fb
Showing
68 changed files
with
3,016 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
test/EndToEnd/Version06/Configuration/Defaults/SleeperTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2021-2024 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/phpunit-slow-test-detector | ||
*/ | ||
|
||
namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\Configuration\Defaults; | ||
|
||
use Ergebnis\PHPUnit\SlowTestDetector\Test; | ||
use PHPUnit\Framework; | ||
|
||
/** | ||
* @covers \Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\Sleeper | ||
*/ | ||
final class SleeperTest extends Framework\TestCase | ||
{ | ||
public function testSleeperSleepsLessThanDefaultMaximumDuration(): void | ||
{ | ||
$milliseconds = 10; | ||
|
||
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); | ||
|
||
$sleeper->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<int, array{0: int}> | ||
*/ | ||
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable | ||
{ | ||
$values = \range( | ||
600, | ||
1600, | ||
100 | ||
); | ||
|
||
foreach ($values as $value) { | ||
yield $value => [ | ||
$value, | ||
]; | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/EndToEnd/Version06/Configuration/Defaults/phpunit.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd" | ||
beStrictAboutChangesToGlobalState="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
bootstrap="../../../../../vendor/autoload.php" | ||
colors="true" | ||
columns="max" | ||
forceCoversAnnotation="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
verbose="true" | ||
> | ||
<extensions> | ||
<extension class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/> | ||
</extensions> | ||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory>.</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
With default configuration | ||
--FILE-- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PHPUnit\TextUI; | ||
|
||
$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version06/Configuration/Defaults/phpunit.xml'; | ||
|
||
require_once __DIR__ . '/../../../../../vendor/autoload.php'; | ||
|
||
PHPUnit\TextUI\Command::main(); | ||
--EXPECTF-- | ||
PHPUnit %s | ||
|
||
Runtime: %s | ||
Configuration: %s/EndToEnd/Version06/Configuration/Defaults/phpunit.xml | ||
|
||
............ 12 / 12 (100%) | ||
|
||
Detected 11 tests where the duration exceeded the maximum duration. | ||
|
||
1. 1.6%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #10 (1600) | ||
2. 1.5%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #9 (1500) | ||
3. 1.4%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #8 (1400) | ||
4. 1.3%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #7 (1300) | ||
5. 1.2%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #6 (1200) | ||
6. 1.1%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #5 (1100) | ||
7. 1.0%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #4 (1000) | ||
8. 0.9%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #3 (900) | ||
9. 0.8%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (800) | ||
10. 0.7%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Configuration\Defaults\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (700) | ||
|
||
There is 1 additional slow test that is not listed here. | ||
|
||
Time: %s, Memory: %s | ||
|
||
OK (12 tests, 12 assertions) |
64 changes: 64 additions & 0 deletions
64
test/EndToEnd/Version06/Configuration/MaximumCount/SleeperTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2021-2024 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/phpunit-slow-test-detector | ||
*/ | ||
|
||
namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\Configuration\MaximumCount; | ||
|
||
use Ergebnis\PHPUnit\SlowTestDetector\Test; | ||
use PHPUnit\Framework; | ||
|
||
/** | ||
* @covers \Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\Sleeper | ||
*/ | ||
final class SleeperTest extends Framework\TestCase | ||
{ | ||
public function testSleeperSleepsLessThanDefaultMaximumDuration(): void | ||
{ | ||
$milliseconds = 10; | ||
|
||
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); | ||
|
||
$sleeper->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<int, array{0: int}> | ||
*/ | ||
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable | ||
{ | ||
$values = \range( | ||
600, | ||
1000, | ||
100 | ||
); | ||
|
||
foreach ($values as $value) { | ||
yield $value => [ | ||
$value, | ||
]; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
test/EndToEnd/Version06/Configuration/MaximumCount/phpunit.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd" | ||
beStrictAboutChangesToGlobalState="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
bootstrap="../../../../../vendor/autoload.php" | ||
colors="true" | ||
columns="max" | ||
forceCoversAnnotation="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
verbose="true" | ||
> | ||
<extensions> | ||
<extension class="Ergebnis\PHPUnit\SlowTestDetector\Extension"> | ||
<arguments> | ||
<array> | ||
<element key="maximum-count"> | ||
<integer>3</integer> | ||
</element> | ||
</array> | ||
</arguments> | ||
</extension> | ||
</extensions> | ||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory>.</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
Oops, something went wrong.