From d9b8fa49458ca3af0d713c4b2bbaa0004df3e547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 2 Feb 2024 14:45:37 +0100 Subject: [PATCH] Enhancement: Add support for phpunit/phpunit:^11.0.0 --- .github/settings.yml | 6 ++-- .github/workflows/integrate.yaml | 26 +++++++++++------ CHANGELOG.md | 2 ++ README.md | 7 +++++ composer.json | 2 +- composer.lock | 14 +++++----- manifest.xml | 2 +- test/Phar/Version11/SleeperTest.php | 43 +++++++++++++++++++++++++++++ test/Phar/Version11/bootstrap.php | 14 ++++++++++ test/Phar/Version11/phpunit.xml | 33 ++++++++++++++++++++++ 10 files changed, 129 insertions(+), 20 deletions(-) create mode 100644 test/Phar/Version11/SleeperTest.php create mode 100644 test/Phar/Version11/bootstrap.php create mode 100644 test/Phar/Version11/phpunit.xml diff --git a/.github/settings.yml b/.github/settings.yml index 5dac1deb..f24e6057 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -49,8 +49,10 @@ branches: - context: "Tests (10.0.0, 8.2, lowest)" - context: "Tests (10.0.0, 8.3, highest)" - context: "Tests (10.0.0, 8.3, lowest)" - - context: "Tests (11.0.x-dev, 8.2, highest)" - - context: "Tests (11.0.x-dev, 8.3, highest)" + - context: "Tests (11.0.0, 8.2, lowest)" + - context: "Tests (11.0.0, 8.2, highest)" + - context: "Tests (11.0.0, 8.3, highest)" + - context: "Tests (11.0.0, 8.3, lowest)" strict: false restrictions: diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 0726b8b1..866769d3 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -504,11 +504,19 @@ jobs: php-version: "8.3" dependencies: "highest" - - phpunit-version: "11.0.x-dev" + - phpunit-version: "11.0.0" + php-version: "8.2" + dependencies: "lowest" + + - phpunit-version: "11.0.0" php-version: "8.2" dependencies: "highest" - - phpunit-version: "11.0.x-dev" + - phpunit-version: "11.0.0" + php-version: "8.3" + dependencies: "lowest" + + - phpunit-version: "11.0.0" php-version: "8.3" dependencies: "highest" @@ -554,13 +562,9 @@ jobs: run: "composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress" - name: "Require phpunit/phpunit:^${{ matrix.phpunit-version }}" - if: "matrix.dependencies != 'locked' && matrix.phpunit-version != '11.0.x-dev'" + if: "matrix.dependencies != 'locked'" run: "composer require phpunit/phpunit:^${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies" - - name: "Require phpunit/phpunit:${{ matrix.phpunit-version }}" - if: "matrix.dependencies != 'locked' && matrix.phpunit-version == '11.0.x-dev'" - run: "composer require phpunit/phpunit:${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies" - - name: "Install ${{ matrix.dependencies }} dependencies with composer" uses: "ergebnis/.github/actions/composer/install@1.9.0" with: @@ -593,8 +597,8 @@ jobs: if: "matrix.phpunit-version == '10.0.0'" run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version10/phpunit.xml" - - name: "Run end-to-end tests with phpunit/phpunit:11.0.x-dev" - if: "matrix.phpunit-version == '11.0.x-dev'" + - name: "Run end-to-end tests with phpunit/phpunit:11.0.0" + if: "matrix.phpunit-version == '11.0.0'" run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml" - name: "Download Phar" @@ -621,3 +625,7 @@ jobs: - name: "Run phar tests with phpunit/phpunit:10.0.0" if: "matrix.phpunit-version == '10.0.0'" run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version10/phpunit.xml" + + - name: "Run phar tests with phpunit/phpunit:11.0.0" + if: "matrix.phpunit-version == '11.0.0'" + run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version11/phpunit.xml" diff --git a/CHANGELOG.md b/CHANGELOG.md index 43743a8e..bc44d46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ For a full diff see [`2.9.0...main`][2.9.0...main]. ### Changed +- Added support for `phpunit/phpunit:^11.0.0` ([#485]), by [@localheinz] - Added support for using `phpunit-slow-test-detector.phar` with `phpunit/phpunit:^9.0.0` ([#491]), by [@localheinz] - Added support for using `phpunit-slow-test-detector.phar` with `phpunit/phpunit:^8.5.19` ([#494]), by [@localheinz] - 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]. [#396]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/396 [#447]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/447 [#448]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/448 +[#485]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/485 [#491]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/491 [#494]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/494 [#495]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/495 diff --git a/README.md b/README.md index 90ed819a..59dc9f33 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ The extension is compatible with the following versions of `phpunit/phpunit`: - [`phpunit/phpunit:^8.5.19`](https://github.com/sebastianbergmann/phpunit/tree/8.5.19) - [`phpunit/phpunit:^9.0.0`](https://github.com/sebastianbergmann/phpunit/tree/9.0.0) - [`phpunit/phpunit:^10.0.0`](https://github.com/sebastianbergmann/phpunit/tree/10.0.0) +- [`phpunit/phpunit:^11.0.0`](https://github.com/sebastianbergmann/phpunit/tree/11.0.0) ## Installation @@ -37,6 +38,7 @@ to install `ergebnis/phpunit-slow-test-detector` as a `composer` package when us - `phpunit/phpunit:^8.5.19` - `phpunit/phpunit:^9.0.0` - `phpunit/phpunit:^10.0.0` +- `phpunit/phpunit:^11.0.0` ### Installation as Phar @@ -44,6 +46,7 @@ Download `phpunit-slow-test-detector.phar` from the [latest release](https://git - `phpunit/phpunit:^9.0.0` - `phpunit/phpunit:^10.0.0` +- `phpunit/phpunit:^11.0.0` ## Usage @@ -222,10 +225,12 @@ The following example configures the maximum count of slow tests to three, and t To configure the extension when using - `phpunit/phpunit:^10.0.0` +- `phpunit/phpunit:^11.0.0` adjust your `phpunit.xml` configuration file and configure one or more - [`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/) +- [`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/) The following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds: @@ -256,6 +261,7 @@ You can configure the maximum duration for a single test case with - an `Attribute\MaximumDuration` attribute when using - `phpunit/phpunit:^10.0.0` + - `phpunit/phpunit:^11.0.0` - a `@maximumDuration` annotation in the DocBlock when using - `phpunit/phpunit:^7.5.0` - `phpunit/phpunit:^8.5.19` @@ -384,6 +390,7 @@ When phpunit/phpunit invokes `PHPUnit\Framework\TestCase::runBare()`, it will in When using - `phpunit/phpunit:^10.0.0` +- `phpunit/phpunit:^11.0.0` the extension uses the new event system of `phpunit/phpunit`. diff --git a/composer.json b/composer.json index 54622b71..ca077408 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require": { "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "phpunit/phpunit": "^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0" + "phpunit/phpunit": "^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0 || ^11.0.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.42.0", diff --git a/composer.lock b/composer.lock index 7daf6ecc..addb81ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "714f687b9a28472628c3765018af8a9b", + "content-hash": "4f23af5bf901f5e727b8278868633228", "packages": [ { "name": "doctrine/instantiator", @@ -623,16 +623,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.15", + "version": "9.6.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f", + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f", "shasum": "" }, "require": { @@ -706,7 +706,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16" }, "funding": [ { @@ -722,7 +722,7 @@ "type": "tidelift" } ], - "time": "2023-12-01T16:55:19+00:00" + "time": "2024-01-19T07:03:14+00:00" }, { "name": "sebastian/cli-parser", diff --git a/manifest.xml b/manifest.xml index 630fb19b..2d5ba9f4 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,7 +1,7 @@ - + diff --git a/test/Phar/Version11/SleeperTest.php b/test/Phar/Version11/SleeperTest.php new file mode 100644 index 00000000..676651dc --- /dev/null +++ b/test/Phar/Version11/SleeperTest.php @@ -0,0 +1,43 @@ +sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } + + public function testSleeperSleepsJustAboveDefaultMaximumDuration(): void + { + $milliseconds = 600; + + $sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds); + + $sleeper->sleep(); + + self::assertSame($milliseconds, $sleeper->milliseconds()); + } +} diff --git a/test/Phar/Version11/bootstrap.php b/test/Phar/Version11/bootstrap.php new file mode 100644 index 00000000..4e56e1de --- /dev/null +++ b/test/Phar/Version11/bootstrap.php @@ -0,0 +1,14 @@ + + + + + + + . + + +