Skip to content

Commit bf7654f

Browse files
dunglasfabpot
authored andcommitted
[PhpUnitBridge] Create a predictable symlink pointing to the local install
1 parent 8319669 commit bf7654f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ class SymfonyExcludeListPhpunit {}
283283
chdir($oldPwd);
284284
}
285285

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

0 commit comments

Comments
 (0)