Skip to content

Commit

Permalink
Enhancement: Add support for phpunit/phpunit:^11.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Feb 2, 2024
1 parent eb449d3 commit 4e32e44
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 21 deletions.
6 changes: 4 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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/[email protected]"
with:
Expand Down Expand Up @@ -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"
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down Expand Up @@ -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
Expand Down
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
>
+ <extensions>
+ <bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
+ </extensions>
<testsuites>
<testsuite name="unit">
<directory>test/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>
```
### 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
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -149,6 +170,28 @@ To bootstrap the extension as a PHAR when using `phpunit/phpunit:^10.0.0`, adjus
</phpunit>
```

### 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 [`<phpunit>` element](https://docs.phpunit.de/en/11.0/configuration.html#the-phpunit-element):

```diff
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
+ extensionsDirectory="directory/where/you/saved/the/extension/phars"
>
+ <extensions>
+ <bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
+ </extensions>
<testsuites>
<testsuite name="unit">
<directory>test/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>
```

### Configuring the extension

You can configure the extension with the following options in your `phpunit.xml` configuration file:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e32e44

Please sign in to comment.