1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Load plugins which modify install path early, fixes #10618 (#10621)

This commit is contained in:
Jordi Boggiano 2022-03-15 22:11:19 +01:00 committed by GitHub
parent 7bee425b58
commit 6b97524b25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 6 deletions

View file

@ -127,6 +127,23 @@ class PackageSorterTest extends TestCase
'foo/baz',
),
),
'pre-weighted packages bumped to top incl their deps' => array(
array(
$this->createPackage('foo/bar', array('foo/dep')),
$this->createPackage('foo/bar2', array('foo/dep2')),
$this->createPackage('foo/dep', array()),
$this->createPackage('foo/dep2', array()),
),
array(
'foo/dep',
'foo/bar',
'foo/dep2',
'foo/bar2',
),
array(
'foo/bar' => -1000
)
),
);
}
@ -135,10 +152,11 @@ class PackageSorterTest extends TestCase
*
* @param Package[] $packages
* @param string[] $expectedOrderedList
* @param array<string, int> $weights
*/
public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList)
public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList, $weights = array())
{
$sortedPackages = PackageSorter::sortPackages($packages);
$sortedPackages = PackageSorter::sortPackages($packages, $weights);
$sortedPackageNames = array_map(function ($package) {
return $package->getName();
}, $sortedPackages);