Skip to content

[phpunit/phpunit] Remove dead code from bin/phpunit #1443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rosier
Copy link
Contributor

@rosier rosier commented Jul 29, 2025

Q A
License MIT

My first thought was to remove bin/phpunit in favor of vendor/bin/phpunit, but since bin/phpunit is also mentioned in the docs I opted for removing the dead code.

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 29, 2025 19:17
Copy link

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1443/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1443/index.json
  2. Install the package(s) related to this recipe:

    composer req symfony/flex
    composer req 'phpunit/phpunit:^11.1'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment 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 67%
rename from phpunit/phpunit/9.6/phpunit.xml.dist
rename to phpunit/phpunit/10.0/phpunit.dist.xml
index 6c4bfed..0b31da2 100644
--- a/phpunit/phpunit/9.6/phpunit.xml.dist
+++ b/phpunit/phpunit/10.0/phpunit.dist.xml
@@ -5,16 +5,16 @@
          xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
          backupGlobals="false"
          colors="true"
+         failOnNotice="true"
+         failOnWarning="true"
          bootstrap="tests/bootstrap.php"
-         convertDeprecationsToExceptions="false"
+         cacheDirectory=".phpunit.cache"
 >
     <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>
@@ -23,15 +23,11 @@
         </testsuite>
     </testsuites>
 
-    <coverage processUncoveredFiles="true">
+    <source ignoreSuppressionOfDeprecations="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>
diff --git a/phpunit/phpunit/9.6/tests/bootstrap.php b/phpunit/phpunit/10.0/tests/bootstrap.php
index 8276338..47a5855 100644
--- a/phpunit/phpunit/9.6/tests/bootstrap.php
+++ b/phpunit/phpunit/10.0/tests/bootstrap.php
@@ -7,3 +7,7 @@ require dirname(__DIR__).'/vendor/autoload.php';
 if (method_exists(Dotenv::class, 'bootEnv')) {
     (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
 }
+
+if ($_SERVER['APP_DEBUG']) {
+    umask(0000);
+}
10.0 vs 11.1
diff --git a/phpunit/phpunit/10.0/.env.test b/phpunit/phpunit/11.1/.env.test
index 24a43c0..64bd111 100644
--- a/phpunit/phpunit/10.0/.env.test
+++ b/phpunit/phpunit/11.1/.env.test
@@ -1,4 +1,3 @@
 # define your env variables for the test env here
 KERNEL_CLASS='App\Kernel'
 APP_SECRET='$ecretf0rt3st'
-SYMFONY_DEPRECATIONS_HELPER=999999
diff --git a/phpunit/phpunit/11.1/bin/phpunit b/phpunit/phpunit/11.1/bin/phpunit
new file mode 100755
index 0000000..ac5eef1
--- /dev/null
+++ b/phpunit/phpunit/11.1/bin/phpunit
@@ -0,0 +1,4 @@
+#!/usr/bin/env php
+<?php
+
+require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
diff --git a/phpunit/phpunit/10.0/manifest.json b/phpunit/phpunit/11.1/manifest.json
index a35670a..4cfad08 100644
--- a/phpunit/phpunit/10.0/manifest.json
+++ b/phpunit/phpunit/11.1/manifest.json
@@ -1,8 +1,18 @@
 {
+    "add-lines": [
+        {
+            "file": "phpunit.dist.xml",
+            "content": "            <method>Doctrine\\Deprecations\\Deprecation::trigger</method>\n            <method>Doctrine\\Deprecations\\Deprecation::delegateTriggerToBackend</method>",
+            "position": "after_target",
+            "target": "<deprecationTrigger>",
+            "requires": ["doctrine/deprecations"]
+        }
+    ],
     "copy-from-recipe": {
         ".env.test": ".env.test",
         "phpunit.dist.xml": "phpunit.dist.xml",
-        "tests/": "tests/"
+        "tests/": "tests/",
+        "bin/": "%BIN_DIR%/"
     },
     "gitignore": [
         "/phpunit.xml",
diff --git a/phpunit/phpunit/10.0/phpunit.dist.xml b/phpunit/phpunit/11.1/phpunit.dist.xml
index 0b31da2..db201ce 100644
--- a/phpunit/phpunit/10.0/phpunit.dist.xml
+++ b/phpunit/phpunit/11.1/phpunit.dist.xml
@@ -3,8 +3,8 @@
 <!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
 <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
-         backupGlobals="false"
          colors="true"
+         failOnDeprecation="true"
          failOnNotice="true"
          failOnWarning="true"
          bootstrap="tests/bootstrap.php"
@@ -23,10 +23,18 @@
         </testsuite>
     </testsuites>
 
-    <source ignoreSuppressionOfDeprecations="true" restrictNotices="true" restrictWarnings="true">
+    <source ignoreSuppressionOfDeprecations="true"
+            ignoreIndirectDeprecations="true"
+            restrictNotices="true"
+            restrictWarnings="true"
+    >
         <include>
             <directory>src</directory>
         </include>
+
+        <deprecationTrigger>
+            <function>trigger_deprecation</function>
+        </deprecationTrigger>
     </source>
 
     <extensions>
diff --git a/phpunit/phpunit/11.1/post-install.txt b/phpunit/phpunit/11.1/post-install.txt
new file mode 100644
index 0000000..e9da2a6
--- /dev/null
+++ b/phpunit/phpunit/11.1/post-install.txt
@@ -0,0 +1,3 @@
+  * Write test cases in the tests/ folder
+  * Use MakerBundle's make:test command as a shortcut!
+  * Run the tests with php bin/phpunit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant