mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
parent
7bee425b58
commit
6b97524b25
4 changed files with 45 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue