From f8300d68042db8374ab8b25d90ec5103ee9eb8bd Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Mon, 6 Feb 2023 11:12:56 -0500 Subject: [PATCH] [phpunit] limited support for PHPUnit 10 --- phpunit/phpunit/10.0/.env.test | 6 ++++ phpunit/phpunit/10.0/manifest.json | 11 +++++++ phpunit/phpunit/10.0/phpunit.xml.dist | 37 ++++++++++++++++++++++++ phpunit/phpunit/10.0/tests/bootstrap.php | 11 +++++++ symfony/phpunit-bridge/5.3/bin/phpunit | 12 ++++++-- 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 phpunit/phpunit/10.0/.env.test create mode 100644 phpunit/phpunit/10.0/manifest.json create mode 100644 phpunit/phpunit/10.0/phpunit.xml.dist create mode 100644 phpunit/phpunit/10.0/tests/bootstrap.php diff --git a/phpunit/phpunit/10.0/.env.test b/phpunit/phpunit/10.0/.env.test new file mode 100644 index 000000000..9e7162f0b --- /dev/null +++ b/phpunit/phpunit/10.0/.env.test @@ -0,0 +1,6 @@ +# define your env variables for the test env here +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/10.0/manifest.json b/phpunit/phpunit/10.0/manifest.json new file mode 100644 index 000000000..8af7b3b35 --- /dev/null +++ b/phpunit/phpunit/10.0/manifest.json @@ -0,0 +1,11 @@ +{ + "copy-from-recipe": { + ".env.test": ".env.test", + "phpunit.xml.dist": "phpunit.xml.dist", + "tests/": "tests/" + }, + "gitignore": [ + "/phpunit.xml", + ".phpunit.result.cache" + ] +} diff --git a/phpunit/phpunit/10.0/phpunit.xml.dist b/phpunit/phpunit/10.0/phpunit.xml.dist new file mode 100644 index 000000000..ad9789cb7 --- /dev/null +++ b/phpunit/phpunit/10.0/phpunit.xml.dist @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + tests + + + + + + src + + + + + + diff --git a/phpunit/phpunit/10.0/tests/bootstrap.php b/phpunit/phpunit/10.0/tests/bootstrap.php new file mode 100644 index 000000000..469dccee4 --- /dev/null +++ b/phpunit/phpunit/10.0/tests/bootstrap.php @@ -0,0 +1,11 @@ +bootEnv(dirname(__DIR__).'/.env'); +} diff --git a/symfony/phpunit-bridge/5.3/bin/phpunit b/symfony/phpunit-bridge/5.3/bin/phpunit index f26f2c727..51cc5b5de 100755 --- a/symfony/phpunit-bridge/5.3/bin/phpunit +++ b/symfony/phpunit-bridge/5.3/bin/phpunit @@ -6,9 +6,15 @@ if (!ini_get('date.timezone')) { } if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) { - define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php'); - require PHPUNIT_COMPOSER_INSTALL; - PHPUnit\TextUI\Command::main(); + if (class_exists(PHPUnit\TextUI\Command::class)) { + // PHPUnit < 9.x + define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php'); + require PHPUNIT_COMPOSER_INSTALL; + PHPUnit\TextUI\Command::main(); + } else { + // PHPUnit >= 10.0 + require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit'; + } } 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";