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
Prefix all "vendor" code bundled in PHAR distribution with "PHPUnit" namespace #3575
Prefix all "vendor" code bundled in PHAR distribution with "PHPUnit" namespace #3575
Conversation
I used the created PHAR to run all phpunit 8 ready test suites on my machine (not much but some) and everything worked. When I run the phpunit test suite with the created phar file I get one error.
I'm not quite sure why exactly this one is crashing because the other tests in that class look quite similar. You can check by creating your own scoped phar by:
|
Thank you, @sebastianfeldmann. I will look into this later this week. My current plan is to distribute a scoped version of the PHAR in addition to the non-scoped PHAR to give users the opportunity to (easily) test their test suites with the scoped PHAR. Hopefully sooner rather than later we can then switch to only distributing the scoped PHAR. |
I have merged this into |
Thank you so much, @sebastianfeldmann, for taking this on. Also thanks to @kambo-1st for his initial research and work. The next step will be to offer nightly builds of |
I just cherry-picked the relevant commits from |
This is a follow up pull request of #3086 where @kambo-1st and @theofidry layed the ground work to implement this feature.
What changed:
The ant
phar
task was manipulated the following way.phpscoper
binary and necessary files to the tools directorybuild/phar
directoryphp-scoper
gets executedphp-scoper
copies alle files frombuild/phar
tobuild/phar-scoped
and prefixes all classes with thePHPUnit
namespacephpab
gets executed using the newscoped-phar
directory instead of the originalphar
one.If you want to test the files
php-scoper
generated. You can comment the lines 393 and 394 in the ant configuration.This way you can inspect the generated source code.
You can use the scoped code as is and not in phar by creating a custom autoloader like this.
build/php-scoper/autoload.php
But be aware that this file will be deleted after every ant run.