PoolBuilderTest: add new fixtures for partial updates with locked packages
parent
5dd4b456b9
commit
4f13875f3f
|
@ -3,8 +3,10 @@ Fixed packages do not get loaded from the repos
|
||||||
|
|
||||||
--REQUEST--
|
--REQUEST--
|
||||||
{
|
{
|
||||||
"some/pkg": "*",
|
"require": {
|
||||||
"root/req": "*"
|
"some/pkg": "*",
|
||||||
|
"root/req": "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--FIXED--
|
--FIXED--
|
||||||
|
|
|
@ -3,8 +3,10 @@ Packages replaced by fixed packages do not get loaded from the repos
|
||||||
|
|
||||||
--REQUEST--
|
--REQUEST--
|
||||||
{
|
{
|
||||||
"some/pkg": "*",
|
"require": {
|
||||||
"root/req": "*"
|
"some/pkg": "*",
|
||||||
|
"root/req": "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--FIXED--
|
--FIXED--
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
--TEST--
|
||||||
|
Partially updating one root requirement with transitive deps without root requirements keeps the other root requirement fixed.
|
||||||
|
|
||||||
|
--REQUEST--
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"root/update": "*",
|
||||||
|
"root/fix": "*"
|
||||||
|
},
|
||||||
|
"locked": [
|
||||||
|
{"name": "root/update", "version": "1.0.1", "require": {"dep/dep": "1.*"}, "id": 1},
|
||||||
|
{"name": "dep/dep", "version": "1.0.2", "require": {"root/fix": "1.*"}, "id": 2},
|
||||||
|
{"name": "root/fix", "version": "1.0.3", "id": 3}
|
||||||
|
],
|
||||||
|
"allowList": [
|
||||||
|
"root/update"
|
||||||
|
],
|
||||||
|
"allowTransitiveDepsNoRootRequire": true
|
||||||
|
}
|
||||||
|
|
||||||
|
--FIXED--
|
||||||
|
[
|
||||||
|
]
|
||||||
|
|
||||||
|
--PACKAGES--
|
||||||
|
[
|
||||||
|
{"name": "root/update", "version": "1.0.4", "require": {"dep/dep": "1.*"}},
|
||||||
|
{"name": "root/update", "version": "1.0.5", "require": {"dep/dep": "2.*"}},
|
||||||
|
{"name": "root/fix", "version": "1.0.6"},
|
||||||
|
{"name": "root/fix", "version": "2.0.7"},
|
||||||
|
{"name": "dep/dep", "version": "1.0.8", "require": {"root/fix": "1.*"}},
|
||||||
|
{"name": "dep/dep", "version": "2.0.9", "require": {"root/fix": "2.*"}}
|
||||||
|
]
|
||||||
|
|
||||||
|
--EXPECT--
|
||||||
|
[
|
||||||
|
3,
|
||||||
|
"root/update-1.0.4.0",
|
||||||
|
"root/update-1.0.5.0",
|
||||||
|
"dep/dep-1.0.8.0",
|
||||||
|
"dep/dep-2.0.9.0"
|
||||||
|
]
|
|
@ -0,0 +1,43 @@
|
||||||
|
--TEST--
|
||||||
|
Partially updating one root requirement with transitive deps fully updates another one too.
|
||||||
|
|
||||||
|
--REQUEST--
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"root/update": "*",
|
||||||
|
"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}
|
||||||
|
],
|
||||||
|
"allowList": [
|
||||||
|
"root/update"
|
||||||
|
],
|
||||||
|
"allowTransitiveDeps": true
|
||||||
|
}
|
||||||
|
|
||||||
|
--FIXED--
|
||||||
|
[
|
||||||
|
]
|
||||||
|
|
||||||
|
--PACKAGES--
|
||||||
|
[
|
||||||
|
{"name": "root/update", "version": "1.0.4", "require": {"dep/dep": "1.*"}},
|
||||||
|
{"name": "root/update", "version": "1.0.5", "require": {"dep/dep": "2.*"}},
|
||||||
|
{"name": "root/dep", "version": "1.0.6"},
|
||||||
|
{"name": "root/dep", "version": "2.0.7"},
|
||||||
|
{"name": "dep/dep", "version": "1.0.8", "require": {"root/dep": "1.*"}},
|
||||||
|
{"name": "dep/dep", "version": "2.0.9", "require": {"root/dep": "2.*"}}
|
||||||
|
]
|
||||||
|
|
||||||
|
--EXPECT--
|
||||||
|
[
|
||||||
|
"root/update-1.0.4.0",
|
||||||
|
"root/update-1.0.5.0",
|
||||||
|
"dep/dep-1.0.8.0",
|
||||||
|
"dep/dep-2.0.9.0",
|
||||||
|
"root/dep-1.0.6.0",
|
||||||
|
"root/dep-2.0.7.0"
|
||||||
|
]
|
|
@ -0,0 +1,37 @@
|
||||||
|
--TEST--
|
||||||
|
Partially updating a root requirement without deps, still selects a new dependency if the update results in a replacement missing for another locked package.
|
||||||
|
|
||||||
|
--REQUEST--
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"some/pkg": "*",
|
||||||
|
"root/req": "*"
|
||||||
|
},
|
||||||
|
"locked": [
|
||||||
|
{"name": "some/pkg", "version": "1.0.3", "replace": {"dep/dep": "2.1.0"}, "id": 1},
|
||||||
|
{"name": "root/req", "version": "1.0.0", "require": {"dep/dep": "2.*"}, "id": 2}
|
||||||
|
],
|
||||||
|
"allowList": [
|
||||||
|
"some/pkg"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
--FIXED--
|
||||||
|
[
|
||||||
|
]
|
||||||
|
|
||||||
|
--PACKAGES--
|
||||||
|
[
|
||||||
|
{"name": "some/pkg", "version": "1.0.4"},
|
||||||
|
{"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--
|
||||||
|
[
|
||||||
|
2,
|
||||||
|
"some/pkg-1.0.4.0",
|
||||||
|
"dep/dep-2.3.4.0"
|
||||||
|
]
|
|
@ -18,8 +18,10 @@ Stability flags apply
|
||||||
|
|
||||||
--REQUEST--
|
--REQUEST--
|
||||||
{
|
{
|
||||||
"flagged/pkg": "*",
|
"require": {
|
||||||
"default/pkg": "*"
|
"flagged/pkg": "*",
|
||||||
|
"default/pkg": "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--PACKAGES--
|
--PACKAGES--
|
||||||
|
|
|
@ -73,14 +73,30 @@ class PoolBuilderTest extends TestCase
|
||||||
|
|
||||||
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases);
|
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases);
|
||||||
$repositorySet->addRepository($repo = new ArrayRepository());
|
$repositorySet->addRepository($repo = new ArrayRepository());
|
||||||
|
$repositorySet->addRepository($lockedRepo = new LockArrayRepository());
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$repo->addPackage($loadPackage($package));
|
$repo->addPackage($loadPackage($package));
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
if (isset($requestData['locked'])) {
|
||||||
foreach ($requestData as $package => $constraint) {
|
foreach ($requestData['locked'] as $package) {
|
||||||
|
$lockedRepo->addPackage($loadPackage($package));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$request = new Request($lockedRepo);
|
||||||
|
foreach ($requestData['require'] as $package => $constraint) {
|
||||||
$request->requireName($package, $parser->parseConstraints($constraint));
|
$request->requireName($package, $parser->parseConstraints($constraint));
|
||||||
}
|
}
|
||||||
|
if (isset($requestData['allowList'])) {
|
||||||
|
$transitiveDeps = Request::UPDATE_ONLY_LISTED;
|
||||||
|
if (isset($requestData['allowTransitiveDepsNoRootRequire']) && $requestData['allowTransitiveDepsNoRootRequire']) {
|
||||||
|
$transitiveDeps = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
|
||||||
|
}
|
||||||
|
if (isset($requestData['allowTransitiveDeps']) && $requestData['allowTransitiveDeps']) {
|
||||||
|
$transitiveDeps = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
|
||||||
|
}
|
||||||
|
$request->setUpdateAllowList(array_flip($requestData['allowList']), $transitiveDeps);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($fixed as $fixedPackage) {
|
foreach ($fixed as $fixedPackage) {
|
||||||
$request->fixPackage($loadPackage($fixedPackage));
|
$request->fixPackage($loadPackage($fixedPackage));
|
||||||
|
|
Loading…
Reference in New Issue