1
0
Fork 0

Add test covering replacer unfixing

pull/8850/head
Jordi Boggiano 2020-06-06 15:19:55 +02:00
parent f2befc46c9
commit b7f1550896
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 61 additions and 6 deletions

View File

@ -8,9 +8,9 @@ Partially updating one root requirement with transitive deps fully updates anoth
"root/dep": "*" "root/dep": "*"
}, },
"locked": [ "locked": [
{"name": "root/update", "version": "1.0.1", "require": {"dep/dep": "1.*"}, "id": 1}, {"name": "root/update", "version": "1.0.1", "require": {"dep/dep": "1.*"}},
{"name": "dep/dep", "version": "1.0.2", "require": {"root/dep": "1.*"}, "id": 2}, {"name": "dep/dep", "version": "1.0.2", "require": {"root/dep": "1.*"}},
{"name": "root/dep", "version": "1.0.3", "id": 3} {"name": "root/dep", "version": "1.0.3"}
], ],
"allowList": [ "allowList": [
"root/update" "root/update"

View File

@ -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"
]

View File

@ -113,11 +113,16 @@ class PoolBuilderTest extends TestCase
return $id; return $id;
} }
if ($package instanceof AliasPackage && $id = array_search($package->getAliasOf(), $packageIds, true)) { $suffix = '';
return (string) $package->getName().'-'.$package->getVersion() .' alias of '.$id; 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); }, $result);
$this->assertSame($expect, $result); $this->assertSame($expect, $result);