Skip to content
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

Set prepend-autoloader to false in composer.json #2264

Closed
wants to merge 1 commit into from
Closed

Set prepend-autoloader to false in composer.json #2264

wants to merge 1 commit into from

Conversation

nicolas-grekas
Copy link
Contributor

This should allow e.g. symfony/yaml users to test their code with the latest version of the component, whereas today the phar users are forced to whatever version is bundled inside it.

@sebastianbergmann
Copy link
Owner

What does composer.json have to do with the PHAR version of PHPUnit?

@nicolas-grekas
Copy link
Contributor Author

Right, too quick :) So, the phar version is not autoloaded but "require" all files at bootstrap? Can't we use an autoloader here (a custom one to now collide with composer's)?

@theseer
Copy link
Collaborator

theseer commented Aug 9, 2016

PHPUnit does use a map based autoloader in the PHAR distributed verison, afaik generated by phpab.

But that aside, how would changing the order of autoloading fix the underlying issue you describe?
(Assuming, I understood the problem correctly..)

Your application under test and PHPUnit share the same process space, so you'll always end up with a conflict in case the application and PHPUnit use the same library but in different versions.

Changing the order of loading them won't fix that.

@sebastianbergmann
Copy link
Owner

@nicolas-grekas is correct that the PHAR distribution of PHPUnit does not use an autoloader but instead loads all the sourcecode files from the PHAR on startup. This is done to make sure that no other autoloader prevents PHPUnit from loading its classes from the PHAR.

I will not change the way class loading works for the PHAR. If the PHAR does not work for you then do not use the PHAR.

The real problem that @nicolas-grekas wants to solve, I think, is related to #2015. Somebody really needs to make https://github.com/webmozart/php-scoper usable.

@nicolas-grekas
Copy link
Contributor Author

👍 with #2015 thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants