Sorted generated classmap
parent
c63f0d9642
commit
1ff1b8ac1f
|
@ -145,6 +145,8 @@ EOF;
|
||||||
$classMap[$class] = '$baseDir . '.var_export($path, true).",\n";
|
$classMap[$class] = '$baseDir . '.var_export($path, true).",\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ksort($classMap);
|
||||||
foreach ($classMap as $class => $code) {
|
foreach ($classMap as $class => $code) {
|
||||||
$classmapFile .= ' '.var_export($class, true).' => '.$code;
|
$classmapFile .= ' '.var_export($class, true).' => '.$code;
|
||||||
}
|
}
|
||||||
|
@ -198,13 +200,14 @@ EOF;
|
||||||
*/
|
*/
|
||||||
public function parseAutoloads(array $packageMap)
|
public function parseAutoloads(array $packageMap)
|
||||||
{
|
{
|
||||||
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0');
|
|
||||||
krsort($psr0);
|
|
||||||
|
|
||||||
$sortedPackageMap = $this->sortPackageMap($packageMap);
|
$sortedPackageMap = $this->sortPackageMap($packageMap);
|
||||||
|
|
||||||
|
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0');
|
||||||
$classmap = $this->parseAutoloadsType($sortedPackageMap, 'classmap');
|
$classmap = $this->parseAutoloadsType($sortedPackageMap, 'classmap');
|
||||||
$files = $this->parseAutoloadsType($sortedPackageMap, 'files');
|
$files = $this->parseAutoloadsType($sortedPackageMap, 'files');
|
||||||
|
|
||||||
|
krsort($psr0);
|
||||||
|
|
||||||
return array('psr-0' => $psr0, 'classmap' => $classmap, 'files' => $files);
|
return array('psr-0' => $psr0, 'classmap' => $classmap, 'files' => $files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,9 +238,9 @@ class AutoloadGeneratorTest extends TestCase
|
||||||
$this->assertTrue(file_exists($this->vendorDir.'/composer/autoload_classmap.php'), "ClassMap file needs to be generated.");
|
$this->assertTrue(file_exists($this->vendorDir.'/composer/autoload_classmap.php'), "ClassMap file needs to be generated.");
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
|
|
||||||
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/src/b.php',
|
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/src/b.php',
|
||||||
'ClassMapBaz' => $this->workingDir.'/composer-test-autoload/b/b/lib/c.php',
|
'ClassMapBaz' => $this->workingDir.'/composer-test-autoload/b/b/lib/c.php',
|
||||||
|
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
|
||||||
),
|
),
|
||||||
include ($this->vendorDir.'/composer/autoload_classmap.php')
|
include ($this->vendorDir.'/composer/autoload_classmap.php')
|
||||||
);
|
);
|
||||||
|
@ -275,9 +275,9 @@ class AutoloadGeneratorTest extends TestCase
|
||||||
$this->assertTrue(file_exists($this->vendorDir.'/composer/autoload_classmap.php'), "ClassMap file needs to be generated.");
|
$this->assertTrue(file_exists($this->vendorDir.'/composer/autoload_classmap.php'), "ClassMap file needs to be generated.");
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
|
|
||||||
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/test.php',
|
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/test.php',
|
||||||
'ClassMapBaz' => $this->workingDir.'/composer-test-autoload/c/c/foo/test.php',
|
'ClassMapBaz' => $this->workingDir.'/composer-test-autoload/c/c/foo/test.php',
|
||||||
|
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
|
||||||
),
|
),
|
||||||
include ($this->vendorDir.'/composer/autoload_classmap.php')
|
include ($this->vendorDir.'/composer/autoload_classmap.php')
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,6 +6,6 @@ $vendorDir = dirname(__DIR__);
|
||||||
$baseDir = $vendorDir;
|
$baseDir = $vendorDir;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'Main\\Foo' => $baseDir . '/src/Main/Foo.php',
|
|
||||||
'ClassMapFoo' => $baseDir . '/composersrc/foo.php',
|
'ClassMapFoo' => $baseDir . '/composersrc/foo.php',
|
||||||
|
'Main\\Foo' => $baseDir . '/src/Main/Foo.php',
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,7 @@ $vendorDir = dirname(__DIR__);
|
||||||
$baseDir = dirname($vendorDir);
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
|
|
||||||
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/src/b.php',
|
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/src/b.php',
|
||||||
'ClassMapBaz' => $baseDir . '/composer-test-autoload/b/b/lib/c.php',
|
'ClassMapBaz' => $baseDir . '/composer-test-autoload/b/b/lib/c.php',
|
||||||
|
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,7 @@ $vendorDir = dirname(__DIR__);
|
||||||
$baseDir = dirname($vendorDir);
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
|
|
||||||
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/test.php',
|
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/test.php',
|
||||||
'ClassMapBaz' => $baseDir . '/composer-test-autoload/c/c/foo/test.php',
|
'ClassMapBaz' => $baseDir . '/composer-test-autoload/c/c/foo/test.php',
|
||||||
|
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue