-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PHPUnit-Bridge] symlink phpunit-bridge with relative paths? #37099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The symlink is created by composer. I'm afraid there is nothing we can do here. Closing as explained. |
I'm sorry @nicolas-grekas but this has nothing to do with my composer.json but the composer.json generated by the phpunit bridge here https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php#L214 Could you please reopen the issue? |
Sure. But as I noted, this link is created by composer... |
An idea might be to replace this symlink by the one you want in your Dockerfile, after running |
On Windows we're already using the |
yes: because it's convenient to have one single copy of the bridge when working on the bridge itself. |
I agree it's convenient. Another solution might be to use a relative path instead of an absolute one on the symlink, I believe composer doesn't really care about absolute vs relative. I'll try to work on a PR for that. |
@Seldaek just taught me about the |
Ah! Yes that would fix it, I added the env variable and it works like a charm, thank you. In case anybody ends up here in the future, this how my bin/phpunit looks like with the changes #!/usr/bin/env php
<?php
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
//We use this Composer ENV variable so that repositories in the bridge are mirrored and not symlinked to avoid Docker issues
if (false === getenv('COMPOSER_MIRROR_PATH_REPOS')) {
putenv('COMPOSER_MIRROR_PATH_REPOS=1');
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php'; Thanks @nicolas-grekas |
This appears to be caused by a logic change in Composer in 1.10.4 (released Apr 9) in composer/composer#8700 When the repository phpunit-bridge sets the path to is absolute, the symlink is now set as absolute. Is it possible to make the |
…t-bridge repository
…t-bridge repository
…t-bridge repository
…t-bridge repository
…t-bridge repository # Conflicts: # CHANGELOG-5.3.md
…t-bridge repository
…t-bridge repository
Description
We use Docker containers for our symfony app, and inside the Docker container the Symfony app lives on the "/app" directory and everything works fine. However, from time to time I'd like to execute some specific unit tests from my local machine, which has a very different absolute root directory, and phpunit fails with a file not found error, the main reason being PHPUnit Bridge symlinks with an absolute path to the main vendor folder that doesn't exist outside the Docker container.
Would it be possible to symlink using relative paths? Or if not, would it be ok to tell composer to not symlink and mirror instead? Both solutions would work. Happy to send a PR. Not sure also if this could be considered a bug-fix or not.
Thanks!
The text was updated successfully, but these errors were encountered: