From ac75680b1e58ebd0625d8de2940cecc5d0349ed9 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 22 Apr 2016 23:41:15 +0100 Subject: [PATCH] Make sure the abandoned state is copied over even if the packages are installed already --- src/Composer/Installer.php | 4 ++ .../installer/update-syncs-outdated.test | 45 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/Composer/Test/Fixtures/installer/update-syncs-outdated.test diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 5fd3ebbc5..191b6a67e 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -1090,6 +1090,10 @@ class Installer $newSourceUrl = $newPackage->getSourceUrl(); $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newPackage->getSourceReference(), $newPackage->getDistUrl()); + + if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) { + $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned()); + } } } } diff --git a/tests/Composer/Test/Fixtures/installer/update-syncs-outdated.test b/tests/Composer/Test/Fixtures/installer/update-syncs-outdated.test new file mode 100644 index 000000000..acef95924 --- /dev/null +++ b/tests/Composer/Test/Fixtures/installer/update-syncs-outdated.test @@ -0,0 +1,45 @@ +--TEST-- +Update updates the outdated state of packages +--COMPOSER-- +{ + "repositories": [ + { + "type": "package", + "package": [ + { + "name": "a/a", "version": "1.0.0", "abandoned": "replacement" + } + ] + } + ], + "require": { + "a/a": "1.0.0" + } +} +--INSTALLED-- +[ + { + "name": "a/a", "version": "1.0.0" + } +] +--EXPECT-LOCK-- +{ + "packages": [ + { + "name": "a/a", "version": "1.0.0", + "type": "library", + "abandoned": "replacement" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} +--RUN-- +update +--EXPECT--