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

Unit tests for PSR-4 class loader. #2295

Closed
wants to merge 6 commits into from

Conversation

donquixote
Copy link
Contributor

I added some basic unit tests.
Inspired by https://github.com/symfony/ClassLoader/blob/master/Tests/ClassLoaderTest.php

The symfony test has a number of exotic cases which are poorly documented and are going to be dead weight if we don't know what they do. So I focused on the obvious stuff, and skipped the rest.

@ghost
Copy link

ghost commented Nov 22, 2013

PSR4 has now reached a majority at @php-fig even though the 14 day vote period has not completed. So I guess this PR should be finalized now.

@donquixote
Copy link
Contributor Author

There is a little problem here.
If you run "composer install" on Composer, the vendor/composer/ClassLoader.php will be the one from your system-wide Composer version, and NOT the one from the experimental Composer version we are working on.

The result: composer install + phpunit results in

PHP Fatal error:  Call to undefined method Composer\Autoload\ClassLoader::addPsr4()

We could fix this with a script that replaces the system-generated ClassLoader.php with a copy of the new PSR-4 ClassLoader. I think this is better than to force people to mess with their system-wide composer installation.

@donquixote
Copy link
Contributor Author

Talked with igorw on IRC #composer-dev.
Solution is that everyone needs to run bin/composer install to try this.
Problem solved.

@donquixote
Copy link
Contributor Author

Follow-up PR: https://github.com/composer/composer/pull/2459/files

This one includes unit tests and AutoloadGenerator changes.

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

1 participant