diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 966db3aad0..43b904cf7b 100644 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -464,26 +464,18 @@ function simpletest_script_init() { } // Detect if we're in the top-level process using the private 'execute-test' - // argument. - if (!$args['execute-test']) { - // Determine if the current user is likely to be able to run composer to - // update PHPUnit if necessary. There is no direct way in PHP of determining - // the user running the process, therefore create a file and check if the - // owner is the same as the owner of the current script. The important thing - // is to allow drupal.org's testing infrastructure to update PHPUnit - // automatically. In all other cases it is okay to emit the error message - // telling the user to do the upgrade themselves. - $tmp = tempnam(sys_get_temp_dir(), 'drupal'); - if (fileowner($tmp) === getmyuid() && getmyuid() !== FALSE) { - // Update PHPUnit if needed and possible. There is a later check once the - // autoloader is in place to ensure we're on the correct version. We need to - // do this before the autoloader is in place to ensure that it is correct. - $composer = ($composer = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar`)) - ? $php . ' ' . escapeshellarg($composer) - : 'composer'; - passthru("$composer run-script drupal-phpunit-upgrade-check"); - } - unlink($tmp); + // argument. Determine if being run on drupal.org's testing infrastructure + // using the DCI_JobType environmental variable so we can update PHPUnit + // automatically. In all other cases if an update is necessary, an error + // message will be emitted telling the user to do the upgrade themselves. + if (!$args['execute-test'] && getenv('DCI_JobType') !== FALSE) { + // Update PHPUnit if needed and possible. There is a later check once the + // autoloader is in place to ensure we're on the correct version. We need to + // do this before the autoloader is in place to ensure that it is correct. + $composer = ($composer = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar`)) + ? $php . ' ' . escapeshellarg($composer) + : 'composer'; + passthru("$composer run-script drupal-phpunit-upgrade-check"); } $autoloader = require_once __DIR__ . '/../../autoload.php';