Description
Composer 2.2.0 (releasing early December hopefully) will introduce a new $_composer_autoload_path global variable which is defined when running a Composer binary. See docs for the new feature.
Essentially when running vendor/bin/phpunit
, instead of running a symlink to vendor/phpunit/phpunit/phpunit
, Composer will add an intermediate PHP proxy file which looks like this:
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../phpunit/phpunit/phpunit)
*
* @generated
*/
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
include __DIR__ . '/..'.'/phpunit/phpunit/phpunit';
This means these lines could be changed to support the new variable if present:
Lines 61 to 67 in 9b18457
But the main reason I wanted to point this out is that this will define a new global variable, so any test relying on a given global state might see differences. I'm hoping there aren't too many of these out there, but who knows.
One thing PHPUnit could do is unset the global variable in the bootstrap to ensure it's back to a clean state.