[PhpUnitBridge] Create a predictable symlink pointing to the local install

This commit is contained in:
Kévin Dunglas 2020-08-28 10:54:30 +02:00 committed by Fabien Potencier
parent 831966981b
commit bf7654f245

View File

@ -283,6 +283,16 @@ EOPHP
chdir($oldPwd);
}
// Create a symlink with a predictable path pointing to the currently used version.
// This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
// and for other testing libraries such as Behat using PHPUnit's assertions.
chdir($PHPUNIT_DIR);
if (file_exists('phpunit')) {
@unlink('phpunit');
}
@symlink($PHPUNIT_VERSION_DIR, 'phpunit');
chdir($oldPwd);
if ($PHPUNIT_VERSION < 8.0) {
$argv = array_filter($argv, function ($v) use (&$argc) {
if ('--do-not-cache-result' !== $v) {