Adjust deduplication of files autoloads, refs 9710b26d3f
parent
2b14f0a047
commit
8072448cf3
|
@ -743,7 +743,7 @@ FOOTER;
|
|||
$relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
|
||||
|
||||
if ($type === 'files') {
|
||||
$autoloads[$this->getFileIdentifier($package, $relativePath)] = $relativePath;
|
||||
$autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
|
||||
continue;
|
||||
} elseif ($type === 'classmap') {
|
||||
$autoloads[] = $relativePath;
|
||||
|
@ -760,7 +760,7 @@ FOOTER;
|
|||
|
||||
protected function getFileIdentifier(PackageInterface $package, $path)
|
||||
{
|
||||
return md5($package->getName() . ':' . str_replace("\r\n", "\n", file_get_contents($path)));
|
||||
return md5($package->getName() . ':' . $path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -653,7 +653,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
public function testFilesAutoloadOrderByDependencies()
|
||||
{
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array('files' => array('root.php')));
|
||||
$package->setAutoload(array('files' => array('root2.php')));
|
||||
$package->setRequires(array(new Link('a', 'z/foo')));
|
||||
$package->setRequires(array(new Link('a', 'd/d')));
|
||||
$package->setRequires(array(new Link('a', 'e/e')));
|
||||
|
@ -693,7 +693,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
file_put_contents($this->vendorDir . '/c/lorem/testC.php', '<?php function testFilesAutoloadOrderByDependency3() {}');
|
||||
file_put_contents($this->vendorDir . '/d/d/testD.php', '<?php function testFilesAutoloadOrderByDependency4() {}');
|
||||
file_put_contents($this->vendorDir . '/e/e/testE.php', '<?php function testFilesAutoloadOrderByDependency5() {}');
|
||||
file_put_contents($this->workingDir . '/root.php', '<?php function testFilesAutoloadOrderByDependencyRoot() {}');
|
||||
file_put_contents($this->workingDir . '/root2.php', '<?php function testFilesAutoloadOrderByDependencyRoot() {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php');
|
||||
|
|
|
@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'ca64fb7d3f21566080b945f028f30a2e' => $baseDir . '/devfiles/foo.php',
|
||||
'e5e597abc575cc420a44914c612bb1b3' => $baseDir . '/devfiles/foo.php',
|
||||
);
|
||||
|
|
|
@ -6,9 +6,9 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'358464b1e68dac136ef7d2ec6242b425' => $vendorDir . '/a/a/test.php',
|
||||
'03c187060069af833190628645c24aca' => $vendorDir . '/b/b/test2.php',
|
||||
'e6a1485c8598883535f318df5b64632f' => $vendorDir . '/c/c/foo/bar/test3.php',
|
||||
'c1fb30d7fed4befd8653c015f6c004f6' => $vendorDir . '/c/c/foo/bar/test4.php',
|
||||
'168fcd186353db6d3200ede690c8cfa8' => $baseDir . '/root.php',
|
||||
'6d9003eea93a81f3586b5d9c5bd91272' => $vendorDir . '/a/a/test.php',
|
||||
'e56cac94f86c787e1efd645809df361d' => $vendorDir . '/b/b/test2.php',
|
||||
'df8470dfa2ebd6b31da05b60fb4ec29a' => $vendorDir . '/c/c/foo/bar/test3.php',
|
||||
'68f1e24e6cd39de885cb5a47678e6518' => $vendorDir . '/c/c/foo/bar/test4.php',
|
||||
'61b776fd0ee84fb7d7d958ae46118ded' => $baseDir . '/root.php',
|
||||
);
|
||||
|
|
|
@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'168fcd186353db6d3200ede690c8cfa8' => $baseDir . '/root.php',
|
||||
'61b776fd0ee84fb7d7d958ae46118ded' => $baseDir . '/root.php',
|
||||
);
|
||||
|
|
|
@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'8d2db77ca7611f10a41ca43619ad167f' => $baseDir . '/foo.php',
|
||||
'54c6b911effcf924f7ff3e89a29f9217' => $baseDir . '/bar.php',
|
||||
'b419c11b924de79ffa740afc29a3dc16' => $baseDir . '/foo.php',
|
||||
'f558c96fbd0535aaa98981fa59ff7594' => $baseDir . '/bar.php',
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue