8000 bug #43799 [PhpUnitBridge] fix symlink to bridge in docker by making … · symfony/symfony@2a98147 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a98147

Browse files
bug #43799 [PhpUnitBridge] fix symlink to bridge in docker by making its path relative (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [PhpUnitBridge] fix symlink to bridge in docker by making its path relative | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #40879 | License | MIT | Doc PR | - This is a simpler and less generic version of #40879 that should fit the goal: > When running symfony from a docker container with a volume mapped to the host, it may cause issues when symlinks are generated from container root, as absolute links. > For composer to generate a relative symlink, declaration of the path repository should be relative. Commits ------- 3672ee2 [PhpUnitBridge] fix symlink to bridge in docker by making its path relative
2 parents 195b673 + 3672ee2 commit 2a98147

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
}
127127

128128
$oldPwd = getcwd();
129-
$PHPUNIT_DIR = $getEnvVar('SYMFONY_PHPUNIT_DIR', $root.'/vendor/bin/.phpunit');
129+
$PHPUNIT_DIR = rtrim($getEnvVar('SYMFONY_PHPUNIT_DIR', $root.'/vendor/bin/.phpunit'), '/'.\DIRECTORY_SEPARATOR);
130130
$PHP = defined('PHP_BINARY') ? \PHP_BINARY : 'php';
131131
$PHP = escapeshellarg($PHP);
132132
if ('phpdbg' === \PHP_SAPI) {
@@ -238,6 +238,10 @@
238238
$passthruOrFail("$COMPOSER config --unset platform.php");
239239
}
240240
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
241+
$p = str_repeat('../', substr_count("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR", '/', strlen($root))).'vendor/symfony/phpunit-bridge';
242+
if (realpath($p) === realpath($path)) {
243+
$path = $p;
244+
}
241245
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
242246
$passthruOrFail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', \DIRECTORY_SEPARATOR, $path)));
243247
if ('\\' === \DIRECTORY_SEPARATOR) {

0 commit comments

Comments
 (0)
0