1
0
Fork 0

Sorted generated classmap

pull/1223/head
Martin Hasoň 2012-10-17 12:00:45 +02:00
parent c63f0d9642
commit 1ff1b8ac1f
5 changed files with 11 additions and 8 deletions

View File

@ -145,6 +145,8 @@ EOF;
$classMap[$class] = '$baseDir . '.var_export($path, true).",\n";
}
}
ksort($classMap);
foreach ($classMap as $class => $code) {
$classmapFile .= ' '.var_export($class, true).' => '.$code;
}
@ -198,13 +200,14 @@ EOF;
*/
public function parseAutoloads(array $packageMap)
{
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0');
krsort($psr0);
$sortedPackageMap = $this->sortPackageMap($packageMap);
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0');
$classmap = $this->parseAutoloadsType($sortedPackageMap, 'classmap');
$files = $this->parseAutoloadsType($sortedPackageMap, 'files');
krsort($psr0);
return array('psr-0' => $psr0, 'classmap' => $classmap, 'files' => $files);
}

View File

@ -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->assertEquals(
array(
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/src/b.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')
);
@ -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->assertEquals(
array(
'ClassMapFoo' => $this->workingDir.'/composer-test-autoload/a/a/src/a.php',
'ClassMapBar' => $this->workingDir.'/composer-test-autoload/b/b/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')
);

View File

@ -6,6 +6,6 @@ $vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;
return array(
'Main\\Foo' => $baseDir . '/src/Main/Foo.php',
'ClassMapFoo' => $baseDir . '/composersrc/foo.php',
'Main\\Foo' => $baseDir . '/src/Main/Foo.php',
);

View File

@ -6,7 +6,7 @@ $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/src/b.php',
'ClassMapBaz' => $baseDir . '/composer-test-autoload/b/b/lib/c.php',
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
);

View File

@ -6,7 +6,7 @@ $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
'ClassMapBar' => $baseDir . '/composer-test-autoload/b/b/test.php',
'ClassMapBaz' => $baseDir . '/composer-test-autoload/c/c/foo/test.php',
'ClassMapFoo' => $baseDir . '/composer-test-autoload/a/a/src/a.php',
);