diff --git a/.github/settings.yml b/.github/settings.yml index a79478b6..9a23528f 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 68ab97e7..53d16462 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -221,7 +221,7 @@ jobs: run: ".phive/box info ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }} --ansi --list" - name: "Run phar tests with phpunit/phpunit" - run: ".phive/phpunit --colors=always --configuration=test/Phar/phpunit.xml" + run: ".phive/phpunit --colors=always --configuration=test/Phar/Version10/phpunit.xml" dependency-analysis: name: "Dependency Analysis" @@ -496,11 +496,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" @@ -543,13 +551,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: @@ -582,6 +586,6 @@ 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" diff --git a/CHANGELOG.md b/CHANGELOG.md index 57f18d92..66120639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 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] + ## [`2.9.0`][2.9.0] For a full diff see [`2.8.0...2.9.0`][2.8.0...2.9.0]. @@ -263,6 +267,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 [@HypeMC]: https://github.com/HypeMC [@localheinz]: https://github.com/localheinz diff --git a/Makefile b/Makefile index 62da19e0..588cec2e 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ phar: phive ## Builds a phar with humbug/box .phive/box compile --config=box.json git checkout HEAD -- composer.json composer.lock .phive/box info .build/phar/phpunit-slow-test-detector.phar --list - .phive/phpunit --configuration=test/Phar/phpunit.xml + .phive/phpunit --configuration=test/Phar/Version10/phpunit.xml + .phive/phpunit --configuration=test/Phar/Version11/phpunit.xml .PHONY: phive phive: .phive ## Installs dependencies with phive @@ -58,7 +59,7 @@ tests: ## Runs unit and end-to-end tests with phpunit/phpunit composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version08/phpunit.xml; git checkout HEAD -- composer.json composer.lock composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version09/phpunit.xml; git checkout HEAD -- composer.json composer.lock composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^10.0.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version10/phpunit.xml; git checkout HEAD -- composer.json composer.lock - composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:11.0.x-dev --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version11/phpunit.xml; git checkout HEAD -- composer.json composer.lock + composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --no-progress; composer require phpunit/phpunit:^11.0.0 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version11/phpunit.xml; git checkout HEAD -- composer.json composer.lock vendor: composer.json composer.lock composer validate --strict diff --git a/README.md b/README.md index 98b09116..a685cd0c 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 @@ -31,11 +32,11 @@ Run composer require --dev ergebnis/phpunit-slow-test-detector ``` -to install `ergebnis/phpunit-slow-test-detector` as a `composer` package when using `phpunit/phpunit:^7.5.0`, `phpunit/phpunit:^8.5.19`, `phpunit/phpunit:^9.0.0`, or `phpunit/phpunit:^10.0.0`. +to install `ergebnis/phpunit-slow-test-detector` as a `composer` package when using `phpunit/phpunit:^7.5.0`, `phpunit/phpunit:^8.5.19`, `phpunit/phpunit:^9.0.0`, `phpunit/phpunit:^10.0.0`, or `phpunit/phpunit:^11.0.0`. ### Installation as Phar -Download `phpunit-slow-test-detector.phar` from the [latest release](https://github.com/ergebnis/phpunit-slow-test-detector/releases/latest) when using `phpunit/phpunit:^10.0.0`. +Download `phpunit-slow-test-detector.phar` from the [latest release](https://github.com/ergebnis/phpunit-slow-test-detector/releases/latest) when using `phpunit/phpunit:^10.0.0` or `phpunit/phpunit:^11.0.0`. ## Usage @@ -110,6 +111,26 @@ To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^ To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^10.0.0`, adjust your `phpunit.xml` configuration file and configure the [`extensions` element](https://docs.phpunit.de/en/10.5/configuration.html#the-extensions-element): +```diff + ++ ++ ++ + + + test/Unit/ + + + +``` +### Bootstrapping the extension as a `composer` package when using `phpunit/phpunit:^11.0.0` + +To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^11.0.0`, adjust your `phpunit.xml` configuration file and configure the [`extensions` element](https://docs.phpunit.de/en/11.0/configuration.html#the-extensions-element): + ```diff ``` +### Bootstrapping the extension as a PHAR when using `phpunit/phpunit:^11.0.0` + +To bootstrap the extension as a PHAR when using `phpunit/phpunit:^11.0.0`, adjust your `phpunit.xml` configuration file and configure the [`extensionsDirectory` attribute](https://docs.phpunit.de/en/11.0/configuration.html#the-extensionsdirectory-attribute) of the [`` element](https://docs.phpunit.de/en/11.0/configuration.html#the-phpunit-element): + +```diff + ++ ++ ++ + + + test/Unit/ + + + +``` + ### Configuring the extension You can configure the extension with the following options in your `phpunit.xml` configuration file: diff --git a/composer.json b/composer.json index e6292b07..ebb53189 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 76f2c16a..3e21282d 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": "bd6ed5a14de319ddc3ee2d8cfa666ac8", + "content-hash": "c4c1f282bdf6384ad6559ef2d7bd96ae", "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/test/Phar/SleeperTest.php b/test/Phar/Version10/SleeperTest.php similarity index 94% rename from test/Phar/SleeperTest.php rename to test/Phar/Version10/SleeperTest.php index 1724e1d4..dd981b2e 100644 --- a/test/Phar/SleeperTest.php +++ b/test/Phar/Version10/SleeperTest.php @@ -11,7 +11,7 @@ * @see https://github.com/ergebnis/phpunit-slow-test-detector */ -namespace Ergebnis\PHPUnit\SlowTestDetector\Test\Phar; +namespace Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\Version10; use Ergebnis\PHPUnit\SlowTestDetector\Test; use PHPUnit\Framework; diff --git a/test/Phar/phpunit.xml b/test/Phar/Version10/phpunit.xml similarity index 100% rename from test/Phar/phpunit.xml rename to test/Phar/Version10/phpunit.xml diff --git a/test/Phar/Version11/SleeperTest.php b/test/Phar/Version11/SleeperTest.php new file mode 100644 index 00000000..dd981b2e --- /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/phpunit.xml b/test/Phar/Version11/phpunit.xml new file mode 100644 index 00000000..d446c7ac --- /dev/null +++ b/test/Phar/Version11/phpunit.xml @@ -0,0 +1,33 @@ + + + + + + + . + + +