Add test verifying unfixing behavior of path repo packages
parent
bd4ba36fa9
commit
0ae5a6ef59
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "mirrored/path-pkg",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"require": {
|
||||||
|
"mirrored/transitive": "2.*",
|
||||||
|
"mirrored/transitive2": "2.*"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
--TEST--
|
||||||
|
Partially updating one root requirement with transitive deps fully updates transitive deps, and always updates symlinked path repos, but not the transitive deps of the path repos.
|
||||||
|
|
||||||
|
--REQUEST--
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"root/update": "*",
|
||||||
|
"symlinked/path-pkg": "*",
|
||||||
|
"mirrored/path-pkg": "*"
|
||||||
|
},
|
||||||
|
"locked": [
|
||||||
|
{"name": "root/update", "version": "1.0.1", "require": {"symlinked/transitive2": ">=1.0.1", "mirrored/transitive2": ">=1.0.1"}},
|
||||||
|
{"name": "symlinked/transitive", "version": "1.0.0"},
|
||||||
|
{"name": "symlinked/transitive2", "version": "1.0.0"},
|
||||||
|
{"name": "mirrored/transitive", "version": "1.0.0"},
|
||||||
|
{"name": "mirrored/transitive2", "version": "1.0.0"},
|
||||||
|
{
|
||||||
|
"name": "symlinked/path-pkg",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"require": {
|
||||||
|
"symlinked/transitive": "1.*",
|
||||||
|
"symlinked/transitive2": "1.*"
|
||||||
|
},
|
||||||
|
"dist": {"type": "path", "url": "./symlinked-path-repo", "reference": "abcd"}, "transport-options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mirrored/path-pkg",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"require": {
|
||||||
|
"mirrored/transitive": "1.*",
|
||||||
|
"mirrored/transitive2": "1.*"
|
||||||
|
},
|
||||||
|
"dist": {"type": "path", "url": "./mirrored-path-repo", "reference": "abcd"}, "transport-options": {"symlink": false}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"allowList": [
|
||||||
|
"root/update"
|
||||||
|
],
|
||||||
|
"allowTransitiveDeps": true
|
||||||
|
}
|
||||||
|
|
||||||
|
--FIXED--
|
||||||
|
[
|
||||||
|
]
|
||||||
|
|
||||||
|
--PACKAGE-REPOS--
|
||||||
|
[
|
||||||
|
{"type": "path", "url": "./symlinked-path-repo"},
|
||||||
|
{"type": "path", "url": "./mirrored-path-repo", "options": {"symlink": false}},
|
||||||
|
[
|
||||||
|
{"name": "root/update", "version": "1.0.4", "require": {"symlinked/transitive2": ">=1.0.1", "mirrored/transitive2": ">=1.0.1"}},
|
||||||
|
{"name": "symlinked/transitive", "version": "1.0.0"},
|
||||||
|
{"name": "symlinked/transitive", "version": "1.0.1"},
|
||||||
|
{"name": "symlinked/transitive", "version": "2.0.2"},
|
||||||
|
{"name": "symlinked/transitive2", "version": "1.0.0"},
|
||||||
|
{"name": "symlinked/transitive2", "version": "1.0.3"},
|
||||||
|
{"name": "symlinked/transitive2", "version": "2.0.4"},
|
||||||
|
{"name": "mirrored/transitive", "version": "1.0.0"},
|
||||||
|
{"name": "mirrored/transitive", "version": "1.0.5"},
|
||||||
|
{"name": "mirrored/transitive", "version": "2.0.6"},
|
||||||
|
{"name": "mirrored/transitive2", "version": "1.0.0"},
|
||||||
|
{"name": "mirrored/transitive2", "version": "1.0.7"},
|
||||||
|
{"name": "mirrored/transitive2", "version": "2.0.8"}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
--EXPECT--
|
||||||
|
[
|
||||||
|
"symlinked/transitive-1.0.0.0 (locked)",
|
||||||
|
"mirrored/transitive-1.0.0.0 (locked)",
|
||||||
|
"mirrored/path-pkg-1.0.0.0 (locked)",
|
||||||
|
"symlinked/path-pkg-2.0.0.0",
|
||||||
|
"root/update-1.0.4.0",
|
||||||
|
"symlinked/transitive2-1.0.3.0",
|
||||||
|
"symlinked/transitive2-2.0.4.0",
|
||||||
|
"mirrored/transitive2-1.0.0.0",
|
||||||
|
"mirrored/transitive2-1.0.7.0",
|
||||||
|
"mirrored/transitive2-2.0.8.0"
|
||||||
|
]
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "symlinked/path-pkg",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"require": {
|
||||||
|
"symlinked/transitive": "2.*",
|
||||||
|
"symlinked/transitive2": "2.*"
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ namespace Composer\Test\DependencyResolver;
|
||||||
use Composer\DependencyResolver\DefaultPolicy;
|
use Composer\DependencyResolver\DefaultPolicy;
|
||||||
use Composer\DependencyResolver\Pool;
|
use Composer\DependencyResolver\Pool;
|
||||||
use Composer\DependencyResolver\PoolOptimizer;
|
use Composer\DependencyResolver\PoolOptimizer;
|
||||||
|
use Composer\Config;
|
||||||
use Composer\IO\NullIO;
|
use Composer\IO\NullIO;
|
||||||
use Composer\Repository\ArrayRepository;
|
use Composer\Repository\ArrayRepository;
|
||||||
use Composer\Repository\FilterRepository;
|
use Composer\Repository\FilterRepository;
|
||||||
|
@ -25,6 +26,7 @@ use Composer\Package\AliasPackage;
|
||||||
use Composer\Json\JsonFile;
|
use Composer\Json\JsonFile;
|
||||||
use Composer\Package\Loader\ArrayLoader;
|
use Composer\Package\Loader\ArrayLoader;
|
||||||
use Composer\Package\Version\VersionParser;
|
use Composer\Package\Version\VersionParser;
|
||||||
|
use Composer\Repository\RepositoryFactory;
|
||||||
use Composer\Repository\RepositorySet;
|
use Composer\Repository\RepositorySet;
|
||||||
use Composer\Test\TestCase;
|
use Composer\Test\TestCase;
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ class PoolBuilderTest extends TestCase
|
||||||
$rootAliases[$index]['alias_normalized'] = $parser->normalize($alias['alias']);
|
$rootAliases[$index]['alias_normalized'] = $parser->normalize($alias['alias']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader = new ArrayLoader();
|
$loader = new ArrayLoader(null, true);
|
||||||
$packageIds = array();
|
$packageIds = array();
|
||||||
$loadPackage = function ($data) use ($loader, &$packageIds) {
|
$loadPackage = function ($data) use ($loader, &$packageIds) {
|
||||||
/** @var ?int $id */
|
/** @var ?int $id */
|
||||||
|
@ -79,8 +81,17 @@ class PoolBuilderTest extends TestCase
|
||||||
return $pkg;
|
return $pkg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$oldCwd = getcwd();
|
||||||
|
chdir(__DIR__.'/Fixtures/poolbuilder/');
|
||||||
|
|
||||||
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $rootReferences);
|
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $rootReferences);
|
||||||
foreach ($packageRepos as $packages) {
|
foreach ($packageRepos as $packages) {
|
||||||
|
if (isset($packages['type'])) {
|
||||||
|
$repo = RepositoryFactory::createRepo(new NullIO, new Config(false), $packages);
|
||||||
|
$repositorySet->addRepository($repo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$repo = new ArrayRepository();
|
$repo = new ArrayRepository();
|
||||||
if (isset($packages['canonical']) || isset($packages['only']) || isset($packages['exclude'])) {
|
if (isset($packages['canonical']) || isset($packages['only']) || isset($packages['exclude'])) {
|
||||||
$options = $packages;
|
$options = $packages;
|
||||||
|
@ -142,6 +153,8 @@ class PoolBuilderTest extends TestCase
|
||||||
$result[] = $pool->packageById($i);
|
$result[] = $pool->packageById($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chdir($oldCwd);
|
||||||
|
|
||||||
return array_map(function (BasePackage $package) use ($packageIds) {
|
return array_map(function (BasePackage $package) use ($packageIds) {
|
||||||
if ($id = array_search($package, $packageIds, true)) {
|
if ($id = array_search($package, $packageIds, true)) {
|
||||||
return $id;
|
return $id;
|
||||||
|
|
Loading…
Reference in New Issue