Skip to content

Commit

Permalink
Merge pull request #417 from mvorisek/phpunit_9_0_0
Browse files Browse the repository at this point in the history
Keep full PHPUnit 9.x support
  • Loading branch information
localheinz authored Dec 16, 2023
2 parents 3ddec39 + 2f86dfa commit 4bf3753
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 39 deletions.
20 changes: 10 additions & 10 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@ branches:
- context: "Tests (7.4, 8.5.19, highest)"
- context: "Tests (7.4, 8.5.19, locked)"
- context: "Tests (7.4, 8.5.19, lowest)"
- context: "Tests (7.4, 9.4.3, highest)"
- context: "Tests (7.4, 9.4.3, lowest)"
- context: "Tests (7.4, 9.0.0, highest)"
- context: "Tests (7.4, 9.0.0, lowest)"
- context: "Tests (8.0, 8.5.19, highest)"
- context: "Tests (8.0, 8.5.19, locked)"
- context: "Tests (8.0, 8.5.19, lowest)"
- context: "Tests (8.0, 9.4.3, highest)"
- context: "Tests (8.0, 9.4.3, lowest)"
- context: "Tests (8.0, 9.0.0, highest)"
- context: "Tests (8.0, 9.0.0, lowest)"
- context: "Tests (8.1, 10.0.0, highest)"
- context: "Tests (8.1, 10.0.0, lowest)"
- context: "Tests (8.1, 8.5.19, highest)"
- context: "Tests (8.1, 8.5.19, locked)"
- context: "Tests (8.1, 8.5.19, lowest)"
- context: "Tests (8.1, 9.4.3, highest)"
- context: "Tests (8.1, 9.4.3, lowest)"
- context: "Tests (8.1, 9.0.0, highest)"
- context: "Tests (8.1, 9.0.0, lowest)"
- context: "Tests (8.2, 10.0.0, highest)"
- context: "Tests (8.2, 10.0.0, lowest)"
- context: "Tests (8.2, 8.5.19, highest)"
- context: "Tests (8.2, 8.5.19, locked)"
- context: "Tests (8.2, 8.5.19, lowest)"
- context: "Tests (8.2, 9.4.3, highest)"
- context: "Tests (8.2, 9.4.3, lowest)"
- context: "Tests (8.2, 9.0.0, highest)"
- context: "Tests (8.2, 9.0.0, lowest)"
- context: "Tests (8.3, 10.0.0, highest)"
- context: "Tests (8.3, 10.0.0, lowest)"
- context: "Tests (8.3, 8.5.19, highest)"
- context: "Tests (8.3, 8.5.19, locked)"
- context: "Tests (8.3, 8.5.19, lowest)"
- context: "Tests (8.3, 9.4.3, highest)"
- context: "Tests (8.3, 9.4.3, lowest)"
- context: "Tests (8.3, 9.0.0, highest)"
- context: "Tests (8.3, 9.0.0, lowest)"
strict: false
restrictions:

Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,27 +474,27 @@ jobs:

include:
- php-version: "7.4"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "lowest"

- php-version: "7.4"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "highest"

- php-version: "8.0"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "lowest"

- php-version: "8.0"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "highest"

- php-version: "8.1"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "lowest"

- php-version: "8.1"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "highest"

- php-version: "8.1"
Expand All @@ -506,11 +506,11 @@ jobs:
dependencies: "highest"

- php-version: "8.2"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "lowest"

- php-version: "8.2"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "highest"

- php-version: "8.2"
Expand All @@ -522,11 +522,11 @@ jobs:
dependencies: "highest"

- php-version: "8.3"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "lowest"

- php-version: "8.3"
phpunit-version: "9.4.3"
phpunit-version: "9.0.0"
dependencies: "highest"

- php-version: "8.3"
Expand Down Expand Up @@ -588,12 +588,19 @@ jobs:
if: "matrix.phpunit-version == '8.5.19'"
run: "vendor/bin/phpunit --colors=always --configuration=test/Unit/phpunit.xml"

- name: "Apply patch from https://github.com/sebastianbergmann/phpunit/pull/4486 for phpunit/phpunit:9.0.0"
if: "matrix.php-version == '8.3' && matrix.phpunit-version == '9.0.0' && matrix.dependencies == 'lowest'"
run: |
cd vendor/phpunit/phpunit
wget -O gh-4486.patch https://github.com/sebastianbergmann/phpunit/commit/0a488f22925b3c8732338ef0fbfe7f13cb4cf1d2.patch
patch -p1 < gh-4486.patch
- name: "Run end-to-end tests with phpunit/phpunit:8.5.19"
if: "matrix.phpunit-version == '8.5.19'"
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version8/phpunit.xml"

- name: "Run end-to-end tests with phpunit/phpunit:9.4.3"
if: "matrix.phpunit-version == '9.4.3'"
- name: "Run end-to-end tests with phpunit/phpunit:9.0.0"
if: "matrix.phpunit-version == '9.0.0'"
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version9/phpunit.xml"

- name: "Run end-to-end tests with phpunit/phpunit:10.0.0"
Expand Down
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`2.7.0...main`][2.7.0...main].

### Changed

- Tighten version constraints to allow installation with `phpunit/phpunit:^8.5.19`, `phpunit/phpunit:^9.4.3`, and `phpunit/phpunit:^10.0.0` ([#416]), by [@localheinz]

## [`2.7.0`][2.7.0]

For a full diff see [`2.6.0...2.7.0`][2.6.0...2.7.0].
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tests: ## Runs unit and end-to-end tests with phpunit/phpunit
mkdir -p .build/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/Unit/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:^8.5.19 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version8/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.4.3 --no-interaction --quiet --update-with-all-dependencies; vendor/bin/phpunit --configuration=test/EndToEnd/Version9/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/Version9/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

vendor: composer.json composer.lock
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This project provides a [`composer`](https://getcomposer.org) package and a [Pha
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.4.3`](https://github.com/sebastianbergmann/phpunit/tree/9.4.3)
- [`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)

## Installation
Expand All @@ -30,7 +30,7 @@ Run
composer require --dev ergebnis/phpunit-slow-test-detector
```

to install `ergebnis/phpunit-slow-test-detector` as a `composer` package when using `phpunit/phpunit:^8.5.19`, `phpunit/phpunit:^9.4.3`, or `phpunit/phpunit:^10.0.0`.
to install `ergebnis/phpunit-slow-test-detector` as a `composer` package when using `phpunit/phpunit:^8.5.19`, `phpunit/phpunit:^9.0.0`, or `phpunit/phpunit:^10.0.0`.

### Installation as Phar

Expand Down Expand Up @@ -63,9 +63,9 @@ To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^
</phpunit>
```

### Bootstrapping the extension as a `composer` package when using `phpunit/phpunit:^9.4.3`
### Bootstrapping the extension as a `composer` package when using `phpunit/phpunit:^9.0.0`

To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^9.4.3`, adjust your `phpunit.xml` configuration file and configure the [`extensions` element](https://docs.phpunit.de/en/9.6/configuration.html#the-extensions-element):
To bootstrap the extension as a `composer` package when using `phpunit/phpunit:^9.0.0`, adjust your `phpunit.xml` configuration file and configure the [`extensions` element](https://docs.phpunit.de/en/9.6/configuration.html#the-extensions-element):

```diff
<phpunit
Expand Down Expand Up @@ -169,9 +169,9 @@ The following example configures the maximum count of slow tests to three, and t
</phpunit>
```

### Configuring the extension when using `phpunit/phpunit:^9.4.3`
### Configuring the extension when using `phpunit/phpunit:^9.0.0`

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.4.3`:
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.0.0`:

```diff
<phpunit
Expand Down Expand Up @@ -232,8 +232,8 @@ The following example configures the maximum count of slow tests to three, and t
You can configure the maximum duration for a single test case with

- an `Attribute\MaximumDuration` attribute when using `phpunit/phpunit:^10.0.0`
- a `@maximumDuration` annotation in the DocBlock when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.4.3`
- a `@slowThreshold` annotation in the DocBlock when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.4.3`
- a `@maximumDuration` annotation in the DocBlock when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.0.0`
- a `@slowThreshold` annotation in the DocBlock when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.0.0`

The following example configures the maximum durations for single test cases to 5.000 ms, 4.000 ms, and 3.000 ms:

Expand Down Expand Up @@ -316,9 +316,9 @@ Time: 00:12.601, Memory: 8.00 MB
OK (13 tests, 13 assertions)
```

### Understanding measured test durations when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.4.3`
### Understanding measured test durations when using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.0.0`

When using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.4.3`, the extension uses the hooks event system of `phpunit/phpunit`.
When using `phpunit/phpunit:^8.5.19` or `phpunit/phpunit:^9.0.0`, the extension uses the hooks event system of `phpunit/phpunit`.

The hooks event system supports eleven hook methods that `phpunit/phpunit` invokes during the execution of tests.

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": "^8.5.19 || ^9.4.3 || ^10.0.0"
"phpunit/phpunit": "^8.5.19 || ^9.0.0 || ^10.0.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.28.3",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

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

0 comments on commit 4bf3753

Please sign in to comment.