From f45aca733ab9bf2633ababeac62e9c36f9606028 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 29 Nov 2021 14:13:44 +0100 Subject: [PATCH] Closes #4835 --- ChangeLog-8.5.md | 1 + phpunit | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog-8.5.md b/ChangeLog-8.5.md index ece37dec0a7..95ec079bf7c 100644 --- a/ChangeLog-8.5.md +++ b/ChangeLog-8.5.md @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil ### Changed * [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active +* [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2 ## [8.5.21] - 2021-09-25 diff --git a/phpunit b/phpunit index 4afdd9ad652..d93f85236b6 100755 --- a/phpunit +++ b/phpunit @@ -58,15 +58,21 @@ if (!ini_get('date.timezone')) { ini_set('date.timezone', 'UTC'); } -foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) { - if (file_exists($file)) { - define('PHPUNIT_COMPOSER_INSTALL', $file); +if (isset($GLOBALS['_composer_autoload_path'])) { + define('PHPUNIT_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']); - break; + unset($GLOBALS['_composer_autoload_path']); +} else { + foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) { + if (file_exists($file)) { + define('PHPUNIT_COMPOSER_INSTALL', $file); + + break; + } } -} -unset($file); + unset($file); +} if (!defined('PHPUNIT_COMPOSER_INSTALL')) { fwrite(