recipes
recipes copied to clipboard
Add Recipe for PHPUnit 10
| Q | A |
|---|---|
| License | MIT |
| Doc issue/PR | symfony/symfony-docs#... |
This will add a recipe for PHPUnit 10:
Following changes:
listenersdo not longer exists in PHPUnit 10 where replaced by extensions- the old
extensionsstill exists but need to be written differently- they require
bootstraptag now: https://docs.phpunit.de/en/10.3/configuration.html#the-extensions-element and use the new event system https://docs.phpunit.de/en/10.3/extending-phpunit.html#phpunit-s-event-system (this effects maybe phpunit-bridge and panther)
- they require
- move from
phpunit.xml.disttophpunit.dist.xmlfor better IDE support (same already done for phpstan) see also: https://github.com/sebastianbergmann/phpunit/issues/4650 / https://github.com/sebastianbergmann/phpunit/commit/07a022ad0548823b04c8fab073a7bff2fbcf9c8c - from cache file
.phpunit.result.cacheto cache directory/.phpunit.cache/ - move unrelated Panther ENV vars to Panther recipe
Thanks for the PR 😍
How to test these changes in your application
-
Define the
SYMFONY_ENDPOINTenvironment variable:# On Unix-like (BSD, Linux and macOS) export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1239/index.json # On Windows SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1239/index.json -
Install the package(s) related to this recipe:
composer req 'symfony/flex:^1.16' composer req 'phpunit/phpunit:^10.0' 'symfony/panther:^1.0' -
Don't forget to unset the
SYMFONY_ENDPOINTenvironment variable when done:# On Unix-like (BSD, Linux and macOS) unset SYMFONY_ENDPOINT # On Windows SET SYMFONY_ENDPOINT=
Diff between recipe versions
In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. I'm going keep this comment up to date with any updates of the attached patch.
phpunit/phpunit
4.7 vs 9.3
diff --git a/phpunit/phpunit/4.7/phpunit.xml.dist b/phpunit/phpunit/9.3/phpunit.xml.dist
index db2b29d..23ea5cf 100644
--- a/phpunit/phpunit/4.7/phpunit.xml.dist
+++ b/phpunit/phpunit/9.3/phpunit.xml.dist
@@ -6,12 +6,15 @@
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
+ convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
+ <server name="SYMFONY_PHPUNIT_REMOVE" value="" />
+ <server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
</php>
<testsuites>
@@ -20,11 +23,11 @@
</testsuite>
</testsuites>
- <filter>
- <whitelist processUncoveredFilesFromWhitelist="true">
+ <coverage processUncoveredFiles="true">
+ <include>
<directory suffix=".php">src</directory>
- </whitelist>
- </filter>
+ </include>
+ </coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
9.3 vs 9.6
diff --git a/phpunit/phpunit/9.3/phpunit.xml.dist b/phpunit/phpunit/9.6/phpunit.xml.dist
index 23ea5cf..6c4bfed 100644
--- a/phpunit/phpunit/9.3/phpunit.xml.dist
+++ b/phpunit/phpunit/9.6/phpunit.xml.dist
@@ -33,8 +33,6 @@
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
- <!-- Uncomment when adding extensions
<extensions>
</extensions>
- -->
</phpunit>
9.6 vs 10.0
diff --git a/phpunit/phpunit/9.6/.env.test b/phpunit/phpunit/10.0/.env.test
index 9e7162f..24a43c0 100644
--- a/phpunit/phpunit/9.6/.env.test
+++ b/phpunit/phpunit/10.0/.env.test
@@ -2,5 +2,3 @@
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
-PANTHER_APP_ENV=panther
-PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
diff --git a/phpunit/phpunit/9.6/manifest.json b/phpunit/phpunit/10.0/manifest.json
index 8af7b3b..a35670a 100644
--- a/phpunit/phpunit/9.6/manifest.json
+++ b/phpunit/phpunit/10.0/manifest.json
@@ -1,11 +1,11 @@
{
"copy-from-recipe": {
".env.test": ".env.test",
- "phpunit.xml.dist": "phpunit.xml.dist",
+ "phpunit.dist.xml": "phpunit.dist.xml",
"tests/": "tests/"
},
"gitignore": [
"/phpunit.xml",
- ".phpunit.result.cache"
+ "/.phpunit.cache/"
]
}
diff --git a/phpunit/phpunit/9.6/phpunit.xml.dist b/phpunit/phpunit/10.0/phpunit.dist.xml
similarity index 72%
rename from phpunit/phpunit/9.6/phpunit.xml.dist
rename to phpunit/phpunit/10.0/phpunit.dist.xml
index 6c4bfed..7ca7d74 100644
--- a/phpunit/phpunit/9.6/phpunit.xml.dist
+++ b/phpunit/phpunit/10.0/phpunit.dist.xml
@@ -6,7 +6,7 @@
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
- convertDeprecationsToExceptions="false"
+ cacheDirectory=".phpunit.cache"
>
<php>
<ini name="display_errors" value="1" />
@@ -14,7 +14,7 @@
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
- <server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
+ <server name="SYMFONY_PHPUNIT_VERSION" value="10" />
</php>
<testsuites>
@@ -23,15 +23,11 @@
</testsuite>
</testsuites>
- <coverage processUncoveredFiles="true">
+ <source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
- <directory suffix=".php">src</directory>
+ <directory>src</directory>
</include>
- </coverage>
-
- <listeners>
- <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
- </listeners>
+ </source>
<extensions>
</extensions>
Anything I need to tackle here?
Hello, what are the conditions for validating this request? New Symfony projects don't have a valid default configuration.