diff --git a/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/must-expand-root-reqs.test b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/must-expand-root-reqs.test new file mode 100644 index 000000000..fb52a9b6d --- /dev/null +++ b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/must-expand-root-reqs.test @@ -0,0 +1,36 @@ +--TEST-- +Fixed packages do not get loaded from the repos + +--REQUEST-- +{ + "require": { + "some/pkg": "*", + "root/req": "*" + } +} + +--FIXED-- +[ + {"name": "some/pkg", "version": "1.0.3", "id": 1}, + {"name": "dep/dep", "version": "2.1.5", "id": 2} +] + +--PACKAGE-REPOS-- +[ + [ + {"name": "some/pkg", "version": "1.0.0"}, + {"name": "some/pkg", "version": "1.1.0"}, + {"name": "root/req", "version": "1.0.0", "require": {"dep/dep": "2.*"}}, + {"name": "root/req", "version": "2.0.0", "require": {"dep/dep": "3.*"}}, + {"name": "dep/dep", "version": "2.3.4"}, + {"name": "dep/dep", "version": "3.0.1"} + ] +] + +--EXPECT-- +[ + 1, + 2, + "root/req-1.0.0.0", + "root/req-2.0.0.0" +] diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php index ac7183eef..a72e42c96 100644 --- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php @@ -14,6 +14,7 @@ namespace Composer\Test\DependencyResolver; use Composer\IO\NullIO; use Composer\Repository\ArrayRepository; +use Composer\Repository\FilterRepository; use Composer\Repository\LockArrayRepository; use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\Pool; @@ -74,8 +75,16 @@ class PoolBuilderTest extends TestCase $repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $rootReferences); foreach ($packageRepos as $packages) { - $repositorySet->addRepository($repo = new ArrayRepository()); - foreach ($packages as $package) { + $repo = new ArrayRepository(); + if (isset($packages['canonical']) || isset($packages['only']) || isset($packages['exclude'])) { + $options = $packages; + $packages = $options['packages']; + unset($options['packages']); + $repositorySet->addRepository(new FilterRepository($repo, $options)); + } else { + $repositorySet->addRepository($repo); + } + foreach ($packages as $package) { $repo->addPackage($loadPackage($package)); } }