Skip to content

Commit 68ad1fc

Browse files
committed
Enhancement: Add support for phpunit/phpunit:^8.5.36
1 parent fa9cc29 commit 68ad1fc

File tree

19 files changed

+631
-41
lines changed

19 files changed

+631
-41
lines changed

.github/settings.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,49 @@ branches:
1414
required_approving_review_count: 1
1515
required_status_checks:
1616
checks:
17-
- context: "Code Coverage (7.4, 9.6.0, locked)"
17+
- context: "Code Coverage (7.4, 8.5.36, locked)"
1818
- context: "Coding Standards (7.4, locked)"
1919
- context: "Compile Phar (8.1, locked)"
2020
- context: "Dependency Analysis (7.4, locked)"
2121
- context: "Refactoring (7.4, locked)"
2222
- context: "Security Analysis (7.4, locked)"
2323
- context: "Static Code Analysis (7.4, locked)"
24-
- context: "Tests (7.4, 9.6.0, highest)"
25-
- context: "Tests (7.4, 9.6.0, locked)"
26-
- context: "Tests (7.4, 9.6.0, lowest)"
27-
- context: "Tests (8.0, 9.6.0, highest)"
28-
- context: "Tests (8.0, 9.6.0, locked)"
29-
- context: "Tests (8.0, 9.6.0, lowest)"
24+
- context: "Tests (7.4, 8.5.36, highest)"
25+
- context: "Tests (7.4, 8.5.36, highest)"
26+
- context: "Tests (7.4, 8.5.36, locked)"
27+
- context: "Tests (7.4, 8.5.36, locked)"
28+
- context: "Tests (7.4, 8.5.36, lowest)"
29+
- context: "Tests (7.4, 8.5.36, lowest)"
30+
- context: "Tests (8.0, 8.5.36, highest)"
31+
- context: "Tests (8.0, 8.5.36, highest)"
32+
- context: "Tests (8.0, 8.5.36, locked)"
33+
- context: "Tests (8.0, 8.5.36, locked)"
34+
- context: "Tests (8.0, 8.5.36, lowest)"
35+
- context: "Tests (8.0, 8.5.36, lowest)"
3036
- context: "Tests (8.1, 10.4.0, highest)"
3137
- context: "Tests (8.1, 10.4.0, locked)"
3238
- context: "Tests (8.1, 10.4.0, lowest)"
39+
- context: "Tests (8.1, 8.5.36, highest)"
40+
- context: "Tests (8.1, 8.5.36, locked)"
41+
- context: "Tests (8.1, 8.5.36, lowest)"
3342
- context: "Tests (8.1, 9.6.0, highest)"
3443
- context: "Tests (8.1, 9.6.0, locked)"
3544
- context: "Tests (8.1, 9.6.0, lowest)"
3645
- context: "Tests (8.2, 10.4.0, highest)"
3746
- context: "Tests (8.2, 10.4.0, locked)"
3847
- context: "Tests (8.2, 10.4.0, lowest)"
48+
- context: "Tests (8.2, 8.5.36, highest)"
49+
- context: "Tests (8.2, 8.5.36, locked)"
50+
- context: "Tests (8.2, 8.5.36, lowest)"
3951
- context: "Tests (8.2, 9.6.0, highest)"
4052
- context: "Tests (8.2, 9.6.0, locked)"
4153
- context: "Tests (8.2, 9.6.0, lowest)"
4254
- context: "Tests (8.3, 10.4.0, highest)"
4355
- context: "Tests (8.3, 10.4.0, locked)"
4456
- context: "Tests (8.3, 10.4.0, lowest)"
57+
- context: "Tests (8.3, 8.5.36, highest)"
58+
- context: "Tests (8.3, 8.5.36, locked)"
59+
- context: "Tests (8.3, 8.5.36, lowest)"
4560
- context: "Tests (8.3, 9.6.0, highest)"
4661
- context: "Tests (8.3, 9.6.0, locked)"
4762
- context: "Tests (8.3, 9.6.0, lowest)"

.github/workflows/integrate.yaml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- "7.4"
2323

2424
phpunit-version:
25-
- "9.6.0"
25+
- "8.5.36"
2626

2727
dependencies:
2828
- "locked"
@@ -57,6 +57,9 @@ jobs:
5757
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
5858
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
5959

60+
- name: "Remove incompatible dependencies with composer"
61+
run: "composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress"
62+
6063
- name: "Require phpunit/phpunit:^${{ matrix.phpunit-version }}"
6164
run: "composer require phpunit/phpunit:^${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies"
6265

@@ -454,42 +457,56 @@ jobs:
454457
strategy:
455458
matrix:
456459
php-version:
460+
- "7.4"
461+
- "8.0"
457462
- "8.1"
458463
- "8.2"
459464
- "8.3"
460465

461466
phpunit-version:
467+
- "8.5.36"
462468
- "9.6.0"
463-
- "10.4.0"
464469

465470
dependencies:
466471
- "lowest"
467472
- "locked"
468473
- "highest"
469474

470475
include:
471-
- php-version: "7.4"
472-
phpunit-version: "9.6.0"
476+
- php-version: "8.1"
477+
phpunit-version: "10.4.0"
478+
dependencies: "lowest"
479+
480+
- php-version: "8.1"
481+
phpunit-version: "10.4.0"
482+
dependencies: "locked"
483+
484+
- php-version: "8.1"
485+
phpunit-version: "10.4.0"
486+
dependencies: "highest"
487+
488+
- php-version: "8.2"
489+
phpunit-version: "10.4.0"
473490
dependencies: "lowest"
474491

475-
- php-version: "7.4"
476-
phpunit-version: "9.6.0"
492+
- php-version: "8.2"
493+
phpunit-version: "10.4.0"
477494
dependencies: "locked"
478495

479-
- php-version: "7.4"
480-
phpunit-version: "9.6.0"
496+
- php-version: "8.2"
497+
phpunit-version: "10.4.0"
481498
dependencies: "highest"
482499

483-
- php-version: "8.0"
484-
phpunit-version: "9.6.0"
500+
- php-version: "8.3"
501+
phpunit-version: "10.4.0"
485502
dependencies: "lowest"
486503

487-
- php-version: "8.0"
488-
phpunit-version: "9.6.0"
504+
- php-version: "8.3"
505+
phpunit-version: "10.4.0"
489506
dependencies: "locked"
490507

491-
- php-version: "8.0"
492-
phpunit-version: "9.6.0"
508+
- php-version: "8.3"
509+
phpunit-version: "10.4.0"
493510
dependencies: "highest"
494511

495512
steps:
@@ -537,6 +554,10 @@ jobs:
537554
if: "matrix.phpunit-version == '9.6.0'"
538555
run: "vendor/bin/phpunit --colors=always --configuration=test/Unit/phpunit.xml"
539556

557+
- name: "Run end-to-end tests with phpunit/phpunit:8.5.36"
558+
if: "matrix.phpunit-version == '8.5.36'"
559+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version8/phpunit.xml"
560+
540561
- name: "Run end-to-end tests with phpunit/phpunit:9.6.0"
541562
if: "matrix.phpunit-version == '9.6.0'"
542563
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version9/phpunit.xml"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
For a full diff see [`2.5.0...main`][2.5.0...main].
1010

11+
### Added
12+
13+
- Added support for `phpunit/phpunit:^8.5.36` ([#394]), by [@localheinz]
14+
1115
## [`2.5.0`][2.5.0]
1216

1317
For a full diff see [`2.4.0...2.5.0`][2.4.0...2.5.0].

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ it: refactoring coding-standards security-analysis static-code-analysis tests ##
44
.PHONY: code-coverage
55
code-coverage: ## Collects coverage from running unit tests with phpunit/phpunit
66
mkdir -p .build/phpunit/
7-
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^9.6.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text; git checkout HEAD -- composer.json composer.lock
7+
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^8.5.36 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text; git checkout HEAD -- composer.json composer.lock
88

99
.PHONY: coding-standards
1010
coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
@@ -60,7 +60,8 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
6060
.PHONY: tests
6161
tests: ## Runs unit and end-to-end tests with phpunit/phpunit
6262
mkdir -p .build/phpunit
63-
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^9.6.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/Unit/phpunit.xml; git checkout HEAD -- composer.json composer.lock
63+
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^8.5.36 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/Unit/phpunit.xml; git checkout HEAD -- composer.json composer.lock
64+
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^8.5.36 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version8/phpunit.xml; git checkout HEAD -- composer.json composer.lock
6465
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^9.6.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version9/phpunit.xml; git checkout HEAD -- composer.json composer.lock
6566
composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^10.4.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version10/phpunit.xml; git checkout HEAD -- composer.json composer.lock
6667

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414

1515
This package provides an extension for detecting slow tests in [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit).
1616

17+
The extension is compatible with the following versions of `phpunit/phpunit`:
18+
19+
- [`phpunit/phpunit:^8.5.36`](https://github.com/sebastianbergmann/phpunit/tree/8.5.36)
20+
- [`phpunit/phpunit:^9.6.0`](https://github.com/sebastianbergmann/phpunit/tree/9.6.0)
21+
- [`phpunit/phpunit:^10.4.0`](https://github.com/sebastianbergmann/phpunit/tree/10.4.0)
22+
1723
## Installation
1824

1925
### Composer
@@ -124,7 +130,7 @@ The following example configures the maximum count of slow tests to three, and t
124130
</phpunit>
125131
```
126132

127-
The following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds when using `phpunit/phpunit:^9.6.0`:
133+
The following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds when using `phpunit/phpunit:^8.5.0` or `phpunit/phpunit:^9.6.0`:
128134

129135
```diff
130136
<phpunit

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"require": {
2727
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
28-
"phpunit/phpunit": "^9.6.0 || ^10.4.0"
28+
"phpunit/phpunit": "^8.5.36 || ^9.6.0 || ^10.4.0"
2929
},
3030
"require-dev": {
3131
"ergebnis/composer-normalize": "^2.28.3",

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Extension.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
));
2727
}
2828

29-
if ($phpUnitVersionSeries->major()->equals(Version\Major::fromInt(9))) {
29+
if (
30+
$phpUnitVersionSeries->major()->equals(Version\Major::fromInt(8))
31+
|| $phpUnitVersionSeries->major()->equals(Version\Major::fromInt(9))
32+
) {
3033
/**
3134
* @internal
3235
*/
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) 2021-2023 Andreas Möller
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE.md file that was distributed with this source code.
10+
*
11+
* @see https://github.com/ergebnis/phpunit-slow-test-detector
12+
*/
13+
14+
namespace Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version8\DefaultConfiguration;
15+
16+
use Ergebnis\PHPUnit\SlowTestDetector\Test;
17+
use PHPUnit\Framework;
18+
19+
/**
20+
* @covers \Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\Sleeper
21+
*/
22+
final class SleeperTest extends Framework\TestCase
23+
{
24+
use Test\Util\Helper;
25+
26+
public function testSleeperDoesNotSleepAtAll(): void
27+
{
28+
$milliseconds = 0;
29+
30+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
31+
32+
$sleeper->sleep();
33+
34+
self::assertSame($milliseconds, $sleeper->milliseconds());
35+
}
36+
37+
/**
38+
* @dataProvider provideMillisecondsGreaterThanDefaultMaximumDuration
39+
*/
40+
public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void
41+
{
42+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
43+
44+
$sleeper->sleep();
45+
46+
self::assertSame($milliseconds, $sleeper->milliseconds());
47+
}
48+
49+
/**
50+
* @return \Generator<int, array{0: int}>
51+
*/
52+
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable
53+
{
54+
$values = \range(
55+
550,
56+
1050,
57+
50,
58+
);
59+
60+
foreach ($values as $value) {
61+
yield $value => [
62+
$value,
63+
];
64+
}
65+
}
66+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<phpunit
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
4+
beStrictAboutChangesToGlobalState="true"
5+
beStrictAboutOutputDuringTests="true"
6+
beStrictAboutTestsThatDoNotTestAnything="true"
7+
beStrictAboutTodoAnnotatedTests="true"
8+
bootstrap="../../../../vendor/autoload.php"
9+
cacheResult="false"
10+
colors="true"
11+
columns="max"
12+
forceCoversAnnotation="true"
13+
executionOrder="random"
14+
stopOnError="false"
15+
stopOnFailure="false"
16+
stopOnIncomplete="false"
17+
stopOnSkipped="false"
18+
verbose="true"
19+
>
20+
<extensions>
21+
<extension class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
22+
</extensions>
23+
<testsuites>
24+
<testsuite name="Unit Tests">
25+
<directory>.</directory>
26+
</testsuite>
27+
</testsuites>
28+
</phpunit>

0 commit comments

Comments
 (0)