Skip to content

Commit f8300d6

Browse files
committed
[phpunit] limited support for PHPUnit 10
1 parent b1176e3 commit f8300d6

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed

phpunit/phpunit/10.0/.env.test

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

phpunit/phpunit/10.0/manifest.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"copy-from-recipe": {
3+
".env.test": ".env.test",
4+
"phpunit.xml.dist": "phpunit.xml.dist",
5+
"tests/": "tests/"
6+
},
7+
"gitignore": [
8+
"/phpunit.xml",
9+
".phpunit.result.cache"
10+
]
11+
}

phpunit/phpunit/10.0/phpunit.xml.dist

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
backupGlobals="false"
7+
colors="true"
8+
bootstrap="tests/bootstrap.php"
9+
>
10+
<php>
11+
<ini name="display_errors" value="1" />
12+
<ini name="error_reporting" value="-1" />
13+
<server name="APP_ENV" value="test" force="true" />
14+
<server name="SHELL_VERBOSITY" value="-1" />
15+
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
16+
<server name="SYMFONY_PHPUNIT_VERSION" value="10.0" />
17+
</php>
18+
19+
<testsuites>
20+
<testsuite name="Project Test Suite">
21+
<directory>tests</directory>
22+
</testsuite>
23+
</testsuites>
24+
25+
<coverage>
26+
<include>
27+
<directory suffix=".php">src</directory>
28+
</include>
29+
</coverage>
30+
31+
<!-- Run `composer require symfony/panther` before enabling this extension -->
32+
<!--
33+
<extensions>
34+
<extension class="Symfony\Component\Panther\ServerExtension" />
35+
</extensions>
36+
-->
37+
</phpunit>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
use Symfony\Component\Dotenv\Dotenv;
4+
5+
require dirname(__DIR__).'/vendor/autoload.php';
6+
7+
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
8+
require dirname(__DIR__).'/config/bootstrap.php';
9+
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
10+
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
11+
}

symfony/phpunit-bridge/5.3/bin/phpunit

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ if (!ini_get('date.timezone')) {
66
}
77

88
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
9-
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
10-
require PHPUNIT_COMPOSER_INSTALL;
11-
PHPUnit\TextUI\Command::main();
9+
if (class_exists(PHPUnit\TextUI\Command::class)) {
10+
// PHPUnit < 9.x
11+
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
12+
require PHPUNIT_COMPOSER_INSTALL;
13+
PHPUnit\TextUI\Command::main();
14+
} else {
15+
// PHPUnit >= 10.0
16+
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
17+
}
1218
} else {
1319
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
1420
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";

0 commit comments

Comments
 (0)