Skip to content

[RFC] Add PHPUnit 11 recipe, treat PHPUnitBridge only as a PHPUnit extension #1401

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 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/callable-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ jobs:
name: Generate Flex testing endpoint
if: "always() && steps.checkout.outcome == 'success' && github.base_ref == inputs.branch"
run: |
mkdir .github/flex-endpoint
mkdir .github/flex-endpoint .github/archived
git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-endpoint ${{ github.repository }} ${{ inputs.branch }} flex/pull-${{ github.event.number }} .github/flex-endpoint ${{ inputs.contrib && '--contrib' || '' }}
php .github/recipes-checker-main/run generate:archived-recipes . ${{ inputs.branch }} .github/archived
git stash
git switch -c pr
git switch --orphan flex/pull-${{ github.event.number }}
git reset --hard -q
mv .github/flex-endpoint/*.json .
git add *.json
git commit -m 'Create Flex endpoint' || true
mv .github/archived .
git add archived
git commit -m 'Create Flex archive' || true
git push origin -f flex/pull-${{ github.event.number }}
git switch pr
git stash pop -q
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ defaults:

jobs:
call-qa:
uses: symfony/recipes/.github/workflows/callable-qa.yml@main
uses: symfony/recipes/.github/workflows/callable-qa.yml@5b2dcec
secrets:
token: ${{ secrets.BOT_TOKEN }}
3 changes: 3 additions & 0 deletions phpunit/phpunit/11.1/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
23 changes: 23 additions & 0 deletions phpunit/phpunit/11.1/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
12 changes: 12 additions & 0 deletions phpunit/phpunit/11.1/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"copy-from-recipe": {
".env.test": ".env.test",
"phpunit.dist.xml": "phpunit.dist.xml",
"tests/": "tests/",
"bin/": "bin/"
},
"gitignore": [
"/phpunit.xml",
"/.phpunit.cache/"
]
}
44 changes: 44 additions & 0 deletions phpunit/phpunit/11.1/phpunit.dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-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"
colors="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
bootstrap="tests/bootstrap.php"
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" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<source ignoreSuppressionOfDeprecations="true"
ignoreIndirectDeprecations="true"
restrictNotices="true"
restrictWarnings="true"
>
<include>
<directory>src</directory>
</include>

<deprecationTrigger>
<function>trigger_deprecation</function>
<method>Doctrine\Deprecations\Deprecation::trigger</method>
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
</deprecationTrigger>
</source>

<extensions>
</extensions>
</phpunit>
3 changes: 3 additions & 0 deletions phpunit/phpunit/11.1/post-install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* <fg=blue>Write</> test cases in the <comment>tests/</> folder
* Use MakerBundle's <comment>make:test</> command as a shortcut!
* <fg=blue>Run</> the tests with <comment>php bin/phpunit</>
13 changes: 13 additions & 0 deletions phpunit/phpunit/11.1/tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'/vendor/autoload.php';

if (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}

if ($_SERVER['APP_DEBUG']) {
umask(0000);
}
23 changes: 23 additions & 0 deletions symfony/phpunit-bridge/7.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"add-lines": [
{
"file": "phpunit.xml.dist",
"content": " <listener class=\"Symfony\\Bridge\\PhpUnit\\SymfonyTestsListener\" />",
"position": "after_target",
"target": "<extensions>",
"warn_if_missing": false
},
{
"file": "phpunit.dist.xml",
"content": " <bootstrap class=\"Symfony\\Bridge\\PhpUnit\\SymfonyExtension\">\n <parameter name=\"clock-mock-namespaces\" value=\"App\" />\n <parameter name=\"dns-mock-namespaces\" value=\"App\" />\n </bootstrap>",
"position": "after_target",
"target": "<extensions>",
"warn_if_missing": false
}
],
"conflict": {
"phpunit/phpunit": "<9.6",
"symfony/framework-bundle": "<5.4"
},
"aliases": ["simple-phpunit"]
}
Loading