diff --git a/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-transitive-deps-unfix.test b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-transitive-deps-unfix.test index 7e0cf2d2d..e075c2df2 100644 --- a/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-transitive-deps-unfix.test +++ b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-transitive-deps-unfix.test @@ -8,9 +8,9 @@ Partially updating one root requirement with transitive deps fully updates anoth "root/dep": "*" }, "locked": [ - {"name": "root/update", "version": "1.0.1", "require": {"dep/dep": "1.*"}, "id": 1}, - {"name": "dep/dep", "version": "1.0.2", "require": {"root/dep": "1.*"}, "id": 2}, - {"name": "root/dep", "version": "1.0.3", "id": 3} + {"name": "root/update", "version": "1.0.1", "require": {"dep/dep": "1.*"}}, + {"name": "dep/dep", "version": "1.0.2", "require": {"root/dep": "1.*"}}, + {"name": "root/dep", "version": "1.0.3"} ], "allowList": [ "root/update" diff --git a/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-unfixing-with-replacers.test b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-unfixing-with-replacers.test new file mode 100644 index 000000000..e7cbf742c --- /dev/null +++ b/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/partial-update-unfixing-with-replacers.test @@ -0,0 +1,50 @@ +--TEST-- +Fixed packages and replacers get unfixed correctly (refs https://github.com/composer/composer/pull/8942) + +--REQUEST-- +{ + "require": { + "root/req1": "*", + "root/req3": "*" + }, + "locked": [ + {"name": "root/req1", "version": "1.0.0", "require": {"replacer/pkg": "1.*"}}, + {"name": "root/req3", "version": "1.0.0", "require": {"replaced/pkg": "1.*", "dep/dep": "2.*"}}, + {"name": "replacer/pkg", "version": "1.0.0", "replace": {"replaced/pkg": "*"}}, + {"name": "dep/dep", "version": "2.3.5"} + ], + "allowList": [ + "root/req1" + ], + "allowTransitiveDeps": true +} + +--FIXED-- +[ +] + +--PACKAGES-- +[ + {"name": "root/req1", "version": "1.0.0", "require": {"replacer/pkg": "1.*"}}, + {"name": "root/req1", "version": "1.1.0", "require": {"replacer/pkg": "1.*"}}, + {"name": "root/req3", "version": "1.0.0", "require": {"replaced/pkg": "1.*"}}, + {"name": "root/req3", "version": "1.1.0", "require": {"replaced/pkg": "1.*"}}, + {"name": "replacer/pkg", "version": "1.0.0", "replace": {"replaced/pkg": "*"}}, + {"name": "replacer/pkg", "version": "1.1.0", "replace": {"replaced/pkg": "*"}}, + {"name": "replaced/pkg", "version": "1.2.3"}, + {"name": "replaced/pkg", "version": "1.2.4"}, + {"name": "dep/dep", "version": "2.3.5"}, + {"name": "dep/dep", "version": "2.3.6"} +] + +--EXPECT-- +[ + "root/req3-1.0.0.0 (locked)", + "dep/dep-2.3.5.0 (locked)", + "root/req1-1.0.0.0", + "root/req1-1.1.0.0", + "replacer/pkg-1.0.0.0", + "replacer/pkg-1.1.0.0", + "replaced/pkg-1.2.3.0", + "replaced/pkg-1.2.4.0" +] diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php index f02b99fc9..b756219a2 100644 --- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php @@ -113,11 +113,16 @@ class PoolBuilderTest extends TestCase return $id; } - if ($package instanceof AliasPackage && $id = array_search($package->getAliasOf(), $packageIds, true)) { - return (string) $package->getName().'-'.$package->getVersion() .' alias of '.$id; + $suffix = ''; + if ($package->getRepository() instanceof LockArrayRepository) { + $suffix = ' (locked)'; } - return (string) $package; + if ($package instanceof AliasPackage && $id = array_search($package->getAliasOf(), $packageIds, true)) { + return (string) $package->getName().'-'.$package->getVersion() .' alias of '.$id . $suffix; + } + + return (string) $package . $suffix; }, $result); $this->assertSame($expect, $result);