Fix multi-prefix handling
parent
a9176acecc
commit
51711c2f73
|
@ -84,7 +84,7 @@ EOF;
|
|||
$mainAutoload = $mainPackage->getAutoload();
|
||||
if ($mainPackage->getTargetDir() && $mainAutoload['psr-0']) {
|
||||
$levels = count(explode('/', trim(strtr($mainPackage->getTargetDir(), '\\', '/'), '/')));
|
||||
$prefixes = implode("', '", array_map(function ($prefix) {
|
||||
$prefixes = implode(', ', array_map(function ($prefix) {
|
||||
return var_export($prefix, true);
|
||||
}, array_keys($mainAutoload['psr-0'])));
|
||||
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode(realpath($targetDir), getcwd(), true);
|
||||
|
|
|
@ -145,9 +145,9 @@ class AutoloadGeneratorTest extends TestCase
|
|||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array('Main\\Foo' => ''),
|
||||
'psr-0' => array('Main\\Foo' => '', 'Main\\Bar' => ''),
|
||||
));
|
||||
$package->setTargetDir('Main/Foo');
|
||||
$package->setTargetDir('Main/Foo/');
|
||||
|
||||
$this->repository->expects($this->once())
|
||||
->method('getPackages')
|
||||
|
|
|
@ -19,7 +19,7 @@ return call_user_func(function() {
|
|||
}
|
||||
|
||||
spl_autoload_register(function($class) {
|
||||
$prefixes = array('Main\\Foo');
|
||||
$prefixes = array('Main\\Foo', 'Main\\Bar');
|
||||
foreach ($prefixes as $prefix) {
|
||||
if (0 !== strpos($class, $prefix)) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue