1
0
Fork 0

Merge pull request #5059 from alcohol/issue-4795-2

simplified existing test, added a new test - related to #4795
pull/5035/head
Jordi Boggiano 2016-03-15 10:56:48 +00:00
commit 653326e215
3 changed files with 53 additions and 7 deletions

View File

@ -1175,10 +1175,15 @@ class Installer
$requirePackages = $pool->whatProvides($require->getTarget()); $requirePackages = $pool->whatProvides($require->getTarget());
foreach ($requirePackages as $requirePackage) { foreach ($requirePackages as $requirePackage) {
if (isset($this->updateWhitelist[$requirePackage->getName()])) {
continue;
}
if (isset($skipPackages[$requirePackage->getName()])) { if (isset($skipPackages[$requirePackage->getName()])) {
$this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>'); $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
continue; continue;
} }
$packageQueue->enqueue($requirePackage); $packageQueue->enqueue($requirePackage);
} }
} }

View File

@ -0,0 +1,44 @@
--TEST--
See Github issue #4795 ( github.com/composer/composer/issues/4795 ).
Composer\Installer::whitelistUpdateDependencies should not output a warning for dependencies that need to be updated
that are also a root package, when that root package is also explicitly whitelisted.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "a", "version": "1.0.0" },
{ "name": "a", "version": "1.1.0" },
{ "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } },
{ "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } }
]
}
],
"require": {
"a": "~1.0",
"b": "~1.0"
}
}
--INSTALLED--
[
{ "name": "a", "version": "1.0.0" },
{ "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }
]
--RUN--
update a b --with-dependencies
--EXPECT-OUTPUT--
Loading composer repositories with package information
Updating dependencies (including require-dev)
Writing lock file
Generating autoload files
--EXPECT--
Updating a (1.0.0) to a (1.1.0)
Updating b (1.0.0) to b (1.1.0)

View File

@ -14,27 +14,24 @@ dependency of one the requirements that is whitelisted for update.
{ "name": "a", "version": "1.0.0" }, { "name": "a", "version": "1.0.0" },
{ "name": "a", "version": "1.1.0" }, { "name": "a", "version": "1.1.0" },
{ "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } },
{ "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } }, { "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } }
{ "name": "c", "version": "1.0.0", "require": { "a": "~1.0" } }
] ]
} }
], ],
"require": { "require": {
"a": "~1.0", "a": "~1.0",
"b": "~1.0", "b": "~1.0"
"c": "~1.0"
} }
} }
--INSTALLED-- --INSTALLED--
[ [
{ "name": "a", "version": "1.0.0" }, { "name": "a", "version": "1.0.0" },
{ "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }
{ "name": "c", "version": "1.0.0", "require": { "a": "~1.0" } }
] ]
--RUN-- --RUN--
update B --with-dependencies update b --with-dependencies
--EXPECT-OUTPUT-- --EXPECT-OUTPUT--
<warning>Dependency "a" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning> <warning>Dependency "a" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>