From 9755c471c61c66e8d1d7fd5dd8c3928b1299e570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 5 Feb 2024 15:55:59 +0100 Subject: [PATCH] Enhancement: Add support for using Phar with phpunit/phpunit:^7.5.0 --- .github/workflows/integrate.yaml | 5 +++- CHANGELOG.md | 2 ++ Makefile | 1 + README.md | 2 ++ manifest.xml | 2 +- test/Phar/Version07/SleeperTest.php | 45 +++++++++++++++++++++++++++++ test/Phar/Version07/bootstrap.php | 14 +++++++++ test/Phar/Version07/phpunit.xml | 28 ++++++++++++++++++ 8 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 test/Phar/Version07/SleeperTest.php create mode 100644 test/Phar/Version07/bootstrap.php create mode 100644 test/Phar/Version07/phpunit.xml diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 63a3c671..0726b8b1 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -598,7 +598,6 @@ jobs: run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml" - name: "Download Phar" - if: "matrix.phpunit-version == '8.5.19' || matrix.phpunit-version == '9.0.0' || matrix.phpunit-version == '10.0.0'" uses: "actions/download-artifact@v4.1.1" with: name: "phpunit-slow-test-detector-phar" @@ -607,6 +606,10 @@ jobs: - name: "Remove autoloader for composer" run: "composer install --ansi --no-autoloader --no-interaction" + - name: "Run phar tests with phpunit/phpunit:7.5.0" + if: "matrix.phpunit-version == '7.5.0'" + run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version07/phpunit.xml" + - name: "Run phar tests with phpunit/phpunit:8.5.19" if: "matrix.phpunit-version == '8.5.19'" run: "vendor/bin/phpunit --colors=always --configuration=test/Phar/Version08/phpunit.xml" diff --git a/CHANGELOG.md b/CHANGELOG.md index a60711f2..43743a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ For a full diff see [`2.9.0...main`][2.9.0...main]. - 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] ## [`2.9.0`][2.9.0] @@ -270,6 +271,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0]. [#448]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/448 [#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 [@HypeMC]: https://github.com/HypeMC [@localheinz]: https://github.com/localheinz diff --git a/Makefile b/Makefile index 17742208..b9036b53 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,7 @@ tests: phar ## Runs unit, end-to-end, and phar tests with phpunit/phpunit composer config platform.php --unset; composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --dev --no-interaction --quiet; 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 --quiet; 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 --quiet; 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 --quiet; composer require phpunit/phpunit:^7.5.0 --no-interaction --quiet --update-with-all-dependencies; composer install --no-autoloader --no-interaction --quiet; vendor/bin/phpunit --configuration=test/Phar/Version07/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 --quiet; composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies; composer install --no-autoloader --no-interaction --quiet; vendor/bin/phpunit --configuration=test/Phar/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 --quiet; composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies; composer install --no-autoloader --no-interaction --quiet; vendor/bin/phpunit --configuration=test/Phar/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 --quiet; composer require phpunit/phpunit:^10.0.0 --no-interaction --quiet --update-with-all-dependencies; composer install --no-autoloader --no-interaction --quiet; vendor/bin/phpunit --configuration=test/Phar/Version10/phpunit.xml; git checkout HEAD -- composer.json composer.lock diff --git a/README.md b/README.md index 974f1a2b..90ed819a 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,13 @@ adjust your `phpunit.xml` configuration file and configure the To bootstrap the extension as a PHAR when using +- `phpunit/phpunit:^7.5.0` - `phpunit/phpunit:^8.5.19` - `phpunit/phpunit:^9.0.0` adjust your `phpunit.xml` configuration file and configure the +- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/7.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/7.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^7.5.0`](https://docs.phpunit.de/en/7.5/) - [`extensionsDirectory` attribute](https://docs.phpunit.de/en/8.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/8.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^8.5.19`](https://docs.phpunit.de/en/8.5/) - [`extensionsDirectory` attribute](https://docs.phpunit.de/en/9.6/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/9.6/configuration.html#the-extensions-element) on [`phpunit/phpunit:^9.0.0`](https://docs.phpunit.de/en/9.5/) diff --git a/manifest.xml b/manifest.xml index 1174b4f6..630fb19b 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,7 +1,7 @@ - + diff --git a/test/Phar/Version07/SleeperTest.php b/test/Phar/Version07/SleeperTest.php new file mode 100644 index 00000000..055f3bbe --- /dev/null +++ b/test/Phar/Version07/SleeperTest.php @@ -0,0 +1,45 @@ +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/Version07/bootstrap.php b/test/Phar/Version07/bootstrap.php new file mode 100644 index 00000000..4e56e1de --- /dev/null +++ b/test/Phar/Version07/bootstrap.php @@ -0,0 +1,14 @@ + + + + + + + . + + +