From 0a604cdd8d2cb628dfb87139142a4336e3f6f690 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Mon, 6 Feb 2023 11:33:56 -0500 Subject: [PATCH] allow `bin/phpunit` to work with phpunit 10 --- symfony/phpunit-bridge/5.3/bin/phpunit | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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";