Skip to content

Commit c5bc65e

Browse files
authored
Merge pull request #485 from ergebnis/feature/phpunit-11
Enhancement: Add support for `phpunit/phpunit:^11.0.0`
2 parents 06ab797 + aa65403 commit c5bc65e

File tree

10 files changed

+127
-20
lines changed

10 files changed

+127
-20
lines changed

.github/settings.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ branches:
4949
- context: "Tests (10.0.0, 8.2, lowest)"
5050
- context: "Tests (10.0.0, 8.3, highest)"
5151
- context: "Tests (10.0.0, 8.3, lowest)"
52-
- context: "Tests (11.0.x-dev, 8.2, highest)"
53-
- context: "Tests (11.0.x-dev, 8.3, highest)"
52+
- context: "Tests (11.0.0, 8.2, lowest)"
53+
- context: "Tests (11.0.0, 8.2, highest)"
54+
- context: "Tests (11.0.0, 8.3, highest)"
55+
- context: "Tests (11.0.0, 8.3, lowest)"
5456
strict: false
5557
restrictions:
5658

.github/workflows/integrate.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,19 @@ jobs:
504504
php-version: "8.3"
505505
dependencies: "highest"
506506

507-
- phpunit-version: "11.0.x-dev"
507+
- phpunit-version: "11.0.0"
508+
php-version: "8.2"
509+
dependencies: "lowest"
510+
511+
- phpunit-version: "11.0.0"
508512
php-version: "8.2"
509513
dependencies: "highest"
510514

511-
- phpunit-version: "11.0.x-dev"
515+
- phpunit-version: "11.0.0"
516+
php-version: "8.3"
517+
dependencies: "lowest"
518+
519+
- phpunit-version: "11.0.0"
512520
php-version: "8.3"
513521
dependencies: "highest"
514522

@@ -554,13 +562,9 @@ jobs:
554562
run: "composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress"
555563

556564
- name: "Require phpunit/phpunit:^${{ matrix.phpunit-version }}"
557-
if: "matrix.dependencies != 'locked' && matrix.phpunit-version != '11.0.x-dev'"
565+
if: "matrix.dependencies != 'locked'"
558566
run: "composer require phpunit/phpunit:^${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies"
559567

560-
- name: "Require phpunit/phpunit:${{ matrix.phpunit-version }}"
561-
if: "matrix.dependencies != 'locked' && matrix.phpunit-version == '11.0.x-dev'"
562-
run: "composer require phpunit/phpunit:${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies"
563-
564568
- name: "Install ${{ matrix.dependencies }} dependencies with composer"
565569
uses: "ergebnis/.github/actions/composer/[email protected]"
566570
with:
@@ -593,8 +597,8 @@ jobs:
593597
if: "matrix.phpunit-version == '10.0.0'"
594598
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version10/phpunit.xml"
595599

596-
- name: "Run end-to-end tests with phpunit/phpunit:11.0.x-dev"
597-
if: "matrix.phpunit-version == '11.0.x-dev'"
600+
- name: "Run end-to-end tests with phpunit/phpunit:11.0.0"
601+
if: "matrix.phpunit-version == '11.0.0'"
598602
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml"
599603

600604
- name: "Download Phar"
@@ -621,3 +625,7 @@ jobs:
621625
- name: "Run phar tests with phpunit/phpunit:10.0.0"
622626
if: "matrix.phpunit-version == '10.0.0'"
623627
run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version10/phpunit.xml"
628+
629+
- name: "Run phar tests with phpunit/phpunit:11.0.0"
630+
if: "matrix.phpunit-version == '11.0.0'"
631+
run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version11/phpunit.xml"

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ For a full diff see [`2.9.0...main`][2.9.0...main].
1010

1111
### Changed
1212

13+
- Added support for `phpunit/phpunit:^11.0.0` ([#485]), by [@localheinz]
1314
- Added support for using `phpunit-slow-test-detector.phar` with `phpunit/phpunit:^9.0.0` ([#491]), by [@localheinz]
1415
- Added support for using `phpunit-slow-test-detector.phar` with `phpunit/phpunit:^8.5.19` ([#494]), by [@localheinz]
1516
- Added support for using `phpunit-slow-test-detector.phar` with `phpunit/phpunit:^7.5.0` ([#495]), by [@localheinz]
@@ -269,6 +270,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
269270
[#396]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/396
270271
[#447]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/447
271272
[#448]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/448
273+
[#485]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/485
272274
[#491]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/491
273275
[#494]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/494
274276
[#495]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/495

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The extension is compatible with the following versions of `phpunit/phpunit`:
2020
- [`phpunit/phpunit:^8.5.19`](https://github.com/sebastianbergmann/phpunit/tree/8.5.19)
2121
- [`phpunit/phpunit:^9.0.0`](https://github.com/sebastianbergmann/phpunit/tree/9.0.0)
2222
- [`phpunit/phpunit:^10.0.0`](https://github.com/sebastianbergmann/phpunit/tree/10.0.0)
23+
- [`phpunit/phpunit:^11.0.0`](https://github.com/sebastianbergmann/phpunit/tree/11.0.0)
2324

2425
## Installation
2526

@@ -214,10 +215,12 @@ The following example configures the maximum count of slow tests to three, and t
214215
To configure the extension when using
215216

216217
- `phpunit/phpunit:^10.0.0`
218+
- `phpunit/phpunit:^11.0.0`
217219

218220
adjust your `phpunit.xml` configuration file and configure one or more
219221

220222
- [`parameter` elements](https://docs.phpunit.de/en/10.5/configuration.html#the-parameter-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)
223+
- [`parameter` elements](https://docs.phpunit.de/en/11.0/configuration.html#the-parameter-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)
221224

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

@@ -248,6 +251,7 @@ You can configure the maximum duration for a single test case with
248251

249252
- an `Attribute\MaximumDuration` attribute when using
250253
- `phpunit/phpunit:^10.0.0`
254+
- `phpunit/phpunit:^11.0.0`
251255
- a `@maximumDuration` annotation in the DocBlock when using
252256
- `phpunit/phpunit:^7.5.0`
253257
- `phpunit/phpunit:^8.5.19`
@@ -376,6 +380,7 @@ When phpunit/phpunit invokes `PHPUnit\Framework\TestCase::runBare()`, it will in
376380
When using
377381

378382
- `phpunit/phpunit:^10.0.0`
383+
- `phpunit/phpunit:^11.0.0`
379384

380385
the extension uses the new event system of `phpunit/phpunit`.
381386

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": "^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0"
28+
"phpunit/phpunit": "^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0 || ^11.0.0"
2929
},
3030
"require-dev": {
3131
"ergebnis/composer-normalize": "^2.42.0",

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.

manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<phar xmlns="https://phar.io/xml/manifest/1.0">
33
<contains name="ergebnis/phpunit-slow-test-detector" version="2.9.0" type="extension">
4-
<extension for="phpunit/phpunit" compatible="^7.5 || 8.5 || ^9.0 || ^10.0"/>
4+
<extension for="phpunit/phpunit" compatible="^7.5 || 8.5 || ^9.0 || ^10.0 || ^11.0"/>
55
</contains>
66

77
<copyright>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) 2021-2024 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\Phar\Version11;
15+
16+
use Ergebnis\PHPUnit\SlowTestDetector\Test;
17+
use PHPUnit\Framework;
18+
19+
#[Framework\Attributes\CoversClass(Test\Fixture\Sleeper::class)]
20+
final class SleeperTest extends Framework\TestCase
21+
{
22+
public function testSleeperDoesNotSleepAtAll(): void
23+
{
24+
$milliseconds = 0;
25+
26+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
27+
28+
$sleeper->sleep();
29+
30+
self::assertSame($milliseconds, $sleeper->milliseconds());
31+
}
32+
33+
public function testSleeperSleepsJustAboveDefaultMaximumDuration(): void
34+
{
35+
$milliseconds = 600;
36+
37+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
38+
39+
$sleeper->sleep();
40+
41+
self::assertSame($milliseconds, $sleeper->milliseconds());
42+
}
43+
}

test/Phar/Version11/bootstrap.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) 2021-2024 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+
require_once __DIR__ . '/../../Fixture/Sleeper.php';

test/Phar/Version11/phpunit.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<phpunit
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
4+
beStrictAboutChangesToGlobalState="true"
5+
beStrictAboutOutputDuringTests="true"
6+
beStrictAboutTestsThatDoNotTestAnything="true"
7+
beStrictAboutTodoAnnotatedTests="true"
8+
bootstrap="bootstrap.php"
9+
cacheResult="false"
10+
colors="true"
11+
columns="max"
12+
displayDetailsOnIncompleteTests="true"
13+
displayDetailsOnSkippedTests="true"
14+
displayDetailsOnTestsThatTriggerDeprecations="true"
15+
displayDetailsOnTestsThatTriggerErrors="true"
16+
displayDetailsOnTestsThatTriggerNotices="true"
17+
displayDetailsOnTestsThatTriggerWarnings="true"
18+
executionOrder="random"
19+
extensionsDirectory="../../../.build/phar/"
20+
stopOnError="false"
21+
stopOnFailure="false"
22+
stopOnIncomplete="false"
23+
stopOnSkipped="false"
24+
>
25+
<extensions>
26+
<bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
27+
</extensions>
28+
<testsuites>
29+
<testsuite name="Unit Tests">
30+
<directory>.</directory>
31+
</testsuite>
32+
</testsuites>
33+
</phpunit>

0 commit comments

Comments
 (0)