From dfdcfab82271a6625be3bd221aea7b3d0a2fa362 Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Tue, 15 Mar 2016 11:11:18 +0100 Subject: [PATCH] simplified existing test, added a new test --- .../installer/github-issues-4795-2.test | 44 +++++++++++++++++++ .../installer/github-issues-4795.test | 11 ++--- 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test new file mode 100644 index 000000000..29fc0d38f --- /dev/null +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test @@ -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) diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test index 6dc3ced3d..5a1158f26 100644 --- a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test @@ -14,27 +14,24 @@ dependency of one the requirements that is whitelisted for update. { "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" } }, - { "name": "c", "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", - "c": "~1.0" + "b": "~1.0" } } --INSTALLED-- [ { "name": "a", "version": "1.0.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, - { "name": "c", "version": "1.0.0", "require": { "a": "~1.0" } } + { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } } ] --RUN-- -update B --with-dependencies +update b --with-dependencies --EXPECT-OUTPUT-- Dependency "a" is also a root requirement, but is not explicitly whitelisted. Ignoring.