diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index 4d3eeb8f14..e9cde5c2f9 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -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) {