Skip to content

Commit

Permalink
Upgrade PHPUnit from version 8 to 9
Browse files Browse the repository at this point in the history
PHPUnit version 9 is the latest compatible with PHP 8.0. This PR updates the version in composer.json and migrates phpunit.xml.dist to reflect the version change. Additionally, the scripts section has been updated to set the XDEBUG_MODE parameter to coverage when needed.
  • Loading branch information
lloc committed Oct 18, 2024
1 parent 6d94fc4 commit 1d8f804
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
### Composer template
composer.phar
/vendor/
composer.lock

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
composer.lock

.phpunit.result.cache

Expand All @@ -16,4 +15,4 @@ composer.lock
# but don't ignore the folder and composer.json
# and configuration files.
!/tests/fixtures/*/composer.json
!/tests/fixtures/*/wp-translation-downloader.json
!/tests/fixtures/*/wp-translation-downloader.json
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"mikey179/vfsstream": "^v1.6.10",
"composer/composer": "^2.3.7",
"inpsyde/php-coding-standards": "^1.0.0",
"phpunit/phpunit": "^8.5.26",
"phpunit/phpunit": "^9.6.0",
"vimeo/psalm": "^4.23.0",
"ondram/ci-detector": "^4.1.0"
},
Expand All @@ -48,7 +48,10 @@
"behat": "@php ./vendor/bin/behat",
"cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"psalm": "@php ./vendor/vimeo/psalm/psalm --no-cache --output-format=compact --find-unused-psalm-suppress",
"tests": "@php ./vendor/phpunit/phpunit/phpunit --coverage-text",
"tests": [
"@putenv XDEBUG_MODE=coverage",
"@php ./vendor/phpunit/phpunit/phpunit --coverage-text"
],
"tests:no-coverage": "@php ./vendor/phpunit/phpunit/phpunit --no-coverage",
"tests:unit": "@php ./vendor/phpunit/phpunit/phpunit --testsuite Unit",
"qa": [
Expand Down
34 changes: 16 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
bootstrap="./tests/boot.php"
colors="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="./tests/boot.php" colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 1d8f804

Please sign in to comment.