From c80cb76b9b5082ecc3e5b53b1050f76bb27b127b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 8 Jan 2013 17:34:37 +0100 Subject: [PATCH] Always prepend autoloaders to avoid tools (i.e. phpunit) taking precedence over the project autoloader --- src/Composer/Autoload/AutoloadGenerator.php | 4 ++-- .../Autoload/Fixtures/autoload_real_files_by_dependency.php | 2 +- .../Test/Autoload/Fixtures/autoload_real_functions.php | 2 +- .../Test/Autoload/Fixtures/autoload_real_target_dir.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 0691434c3..5991083f7 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -405,7 +405,7 @@ CLASSMAP; if ($targetDirLoader) { $file .= <<register();{$filesCode} + \$loader->register(true);{$filesCode} return \$loader; } diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php index 6434b76dd..3b58316c6 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php @@ -36,7 +36,7 @@ class ComposerAutoloaderInitFilesAutoloadOrder $loader->addClassMap($classMap); } - $loader->register(); + $loader->register(true); require $vendorDir . '/c/lorem/testC.php'; require $vendorDir . '/z/foo/testA.php'; diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php index a25e920db..2c75be906 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php @@ -36,7 +36,7 @@ class ComposerAutoloaderInitFilesAutoload $loader->addClassMap($classMap); } - $loader->register(); + $loader->register(true); require $vendorDir . '/a/a/test.php'; require $vendorDir . '/b/b/test2.php'; diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php index ec8e392be..c9b6df98f 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php @@ -36,9 +36,9 @@ class ComposerAutoloaderInitTargetDir $loader->addClassMap($classMap); } - spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload')); + spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true); - $loader->register(); + $loader->register(true); return $loader; }