From d6d087d3487ea99046ef30c299bc46c8fe8e0874 Mon Sep 17 00:00:00 2001 From: Rafael Dohms Date: Thu, 2 Oct 2014 23:04:35 +0200 Subject: [PATCH 1/4] Support for Abandoned in Packages Added parsing for abandoned property into the CompletePackage Object. --- src/Composer/Package/AliasPackage.php | 8 +++++ src/Composer/Package/CompletePackage.php | 29 +++++++++++++++++++ .../Package/CompletePackageInterface.php | 14 +++++++++ src/Composer/Package/Dumper/ArrayDumper.php | 4 ++- src/Composer/Package/Loader/ArrayLoader.php | 4 +++ .../Test/Package/Dumper/ArrayDumperTest.php | 22 +++++++++++++- .../Test/Package/Loader/ArrayLoaderTest.php | 27 ++++++++++++++++- 7 files changed, 105 insertions(+), 3 deletions(-) diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index 183f2c740..3ab9c944d 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -333,6 +333,14 @@ class AliasPackage extends BasePackage implements CompletePackageInterface { return $this->aliasOf->getArchiveExcludes(); } + public function isAbandoned() + { + return $this->aliasOf->isAbandoned(); + } + public function getReplacementPackage() + { + return $this->aliasOf->getReplacementPackage(); + } public function __toString() { return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')'; diff --git a/src/Composer/Package/CompletePackage.php b/src/Composer/Package/CompletePackage.php index a884174af..af2e2bc42 100644 --- a/src/Composer/Package/CompletePackage.php +++ b/src/Composer/Package/CompletePackage.php @@ -27,6 +27,7 @@ class CompletePackage extends Package implements CompletePackageInterface protected $homepage; protected $scripts = array(); protected $support = array(); + protected $abandoned = false; /** * @param array $scripts @@ -169,4 +170,32 @@ class CompletePackage extends Package implements CompletePackageInterface { return $this->support; } + + /** + * @return boolean + */ + public function isAbandoned() + { + return (boolean) $this->abandoned; + } + + /** + * @param boolean|string $abandoned + */ + public function setAbandoned($abandoned) + { + $this->abandoned = $abandoned; + } + + /** + * If the package is abandoned and has a suggested replacement, this method returns it + * + * @return string|null + */ + public function getReplacementPackage() + { + return $this->abandoned ?: null; + } + + } diff --git a/src/Composer/Package/CompletePackageInterface.php b/src/Composer/Package/CompletePackageInterface.php index a341766d3..8263a6535 100644 --- a/src/Composer/Package/CompletePackageInterface.php +++ b/src/Composer/Package/CompletePackageInterface.php @@ -78,4 +78,18 @@ interface CompletePackageInterface extends PackageInterface * @return array */ public function getSupport(); + + /** + * Returns if the package is abandoned or not + * + * @return boolean + */ + public function isAbandoned(); + + /** + * If the package is abandoned and has a suggested replacement, this method returns it + * + * @return string + */ + public function getReplacementPackage(); } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 67318c04a..50b2eb610 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -97,7 +97,7 @@ class ArrayDumper 'homepage', 'keywords', 'repositories', - 'support', + 'support' ); $data = $this->dumpValues($package, $keys, $data); @@ -105,6 +105,8 @@ class ArrayDumper if (isset($data['keywords']) && is_array($data['keywords'])) { sort($data['keywords']); } + + $data['abandoned'] = $package->getReplacementPackage() ?: false; } if ($package instanceof RootPackageInterface) { diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 142b15c72..e548c87e7 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -195,6 +195,10 @@ class ArrayLoader implements LoaderInterface if (isset($config['support'])) { $package->setSupport($config['support']); } + + if (isset($config['abandoned'])) { + $package->setAbandoned($config['abandoned']); + } } if ($aliasNormalized = $this->getBranchAlias($config)) { diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php index 5576e3d05..656ec96bc 100644 --- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php +++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php @@ -45,7 +45,8 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase array( 'name' => 'foo', 'version' => '1.0', - 'version_normalized' => '1.0.0.0' + 'version_normalized' => '1.0.0.0', + 'abandoned' => false ), $config ); @@ -62,12 +63,31 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase $this->assertSame('dev', $config['minimum-stability']); } + public function testDumpAbandoned() + { + $this->packageExpects('getReplacementPackage', true); + + $config = $this->dumper->dump($this->package); + + $this->assertSame(true, $config['abandoned']); + } + + public function testDumpAbandonedReplacement() + { + $this->packageExpects('getReplacementPackage', 'foo/bar'); + + $config = $this->dumper->dump($this->package); + + $this->assertSame('foo/bar', $config['abandoned']); + } + /** * @dataProvider getKeys */ public function testKeys($key, $value, $method = null, $expectedValue = null) { $this->packageExpects('get'.ucfirst($method ?: $key), $value); + $this->packageExpects('isAbandoned', $value); $config = $this->dumper->dump($this->package); diff --git a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php index 04a537abd..6e4e2f5ee 100644 --- a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php @@ -117,7 +117,8 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase 'archive' => array( 'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'), ), - 'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')) + 'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')), + 'abandoned' => 'foo/bar' ); $package = $this->loader->load($config); @@ -138,4 +139,28 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Composer\Package\AliasPackage', $package); $this->assertEquals('1.0.x-dev', $package->getPrettyVersion()); } + + public function testAbandoned() + { + $config = array( + 'name' => 'A', + 'version' => '1.2.3.4', + 'abandoned' => 'foo/bar' + ); + + $package = $this->loader->load($config); + $this->assertTrue($package->isAbandoned()); + $this->assertEquals('foo/bar', $package->getReplacementPackage()); + } + + public function testNotAbandoned() + { + $config = array( + 'name' => 'A', + 'version' => '1.2.3.4' + ); + + $package = $this->loader->load($config); + $this->assertFalse($package->isAbandoned()); + } } From 5ed01fb60d6b9056630ead23dcd96327c332ad86 Mon Sep 17 00:00:00 2001 From: Rafael Dohms Date: Thu, 2 Oct 2014 23:19:27 +0200 Subject: [PATCH 2/4] Abandoned support in `show` Executing `composer show` on an abandoned package displays the warnings for package status. --- src/Composer/Command/ShowCommand.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index dbf41ceb9..28ea81028 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -294,6 +294,16 @@ EOT $output->writeln('dist : ' . sprintf('[%s] %s %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference())); $output->writeln('names : ' . implode(', ', $package->getNames())); + if ($package->isAbandoned()) { + $replacement = ($package->getReplacementPackage() !== null) + ? ' The author suggests using the ' . $package->getReplacementPackage(). ' package instead.' + : null; + + $output->writeln( + sprintf('Attention: This package is abandoned and no longer maintained.%s', $replacement) + ); + } + if ($package->getSupport()) { $output->writeln("\nsupport"); foreach ($package->getSupport() as $type => $value) { From f9f2bbac59ed1de898ccf2533e3e290bd80afc26 Mon Sep 17 00:00:00 2001 From: Rafael Dohms Date: Fri, 3 Oct 2014 14:48:28 +0200 Subject: [PATCH 3/4] Abandoned packages support Added warning to the installer process. If any installed packages are flagged, the user will get a warning at the end of the install/update process. --- src/Composer/Installer.php | 20 +++++++++++ .../Fixtures/installer/abandoned-listed.test | 36 +++++++++++++++++++ .../installer/install-dev-using-dist.test | 3 +- ...e-downgrades-non-whitelisted-unstable.test | 6 ++-- .../installer/partial-update-from-lock.test | 6 ++-- .../partial-update-without-lock.test | 8 ++--- .../Fixtures/installer/update-alias-lock.test | 5 +-- ...pdating-dev-updates-url-and-reference.test | 3 +- tests/Composer/Test/InstallerTest.php | 2 +- 9 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 tests/Composer/Test/Fixtures/installer/abandoned-listed.test diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 2899e2bdb..00276f7e5 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -31,6 +31,7 @@ use Composer\Installer\NoopInstaller; use Composer\IO\IOInterface; use Composer\Json\JsonFile; use Composer\Package\AliasPackage; +use Composer\Package\CompletePackage; use Composer\Package\Link; use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\Locker; @@ -239,6 +240,25 @@ class Installer } } + # Find abandoned packages and warn user + foreach ($localRepo->getPackages() as $package) { + if (!$package instanceof CompletePackage || !$package->isAbandoned()) { + continue; + } + + $replacement = (is_string($package->getReplacementPackage())) + ? 'Use ' . $package->getReplacementPackage() . ' instead' + : 'No replacement was suggested'; + + $this->io->write( + sprintf( + "Package %s is abandoned, you should avoid using it. %s.", + $package->getPrettyName(), + $replacement + ) + ); + } + if (!$this->dryRun) { // write lock if ($this->update || !$this->locker->isLocked()) { diff --git a/tests/Composer/Test/Fixtures/installer/abandoned-listed.test b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test new file mode 100644 index 000000000..18f47732e --- /dev/null +++ b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test @@ -0,0 +1,36 @@ +--TEST-- +Abandoned packages are flagged +--COMPOSER-- +{ + "repositories": [ + { + "type": "package", + "package": [ + { "name": "a/a", "version": "1.0.0", "abandoned": true } + ] + }, + { + "type": "package", + "package": [ + { "name": "c/c", "version": "1.0.0", "abandoned": "b/b" } + ] + } + ], + "require": { + "a/a": "1.0.0", + "c/c": "1.0.0" + } +} +--RUN-- +install +--EXPECT-OUTPUT-- +Loading composer repositories with package information +Installing dependencies (including require-dev) +Package a/a is abandoned, you should avoid using it. No replacement was suggested. +Package c/c is abandoned, you should avoid using it. Use b/b instead. +Writing lock file +Generating autoload files + +--EXPECT-- +Installing a/a (1.0.0) +Installing c/c (1.0.0) diff --git a/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test b/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test index af4eed811..5495b60f3 100644 --- a/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test +++ b/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test @@ -38,7 +38,8 @@ install --prefer-dist "reference": "459720ff3b74ee0c0d159277c6f2f5df89d8a4f6", "shasum": null }, - "type": "library" + "type": "library", + "abandoned": false } ], "packages-dev": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test b/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test index f9fd5058a..dd085c5ac 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test @@ -50,9 +50,9 @@ update c/uptodate --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library" }, - { "name": "b/unstable", "version": "1.0.0", "type": "library" }, - { "name": "c/uptodate", "version": "2.0.0", "type": "library" } + { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "c/uptodate", "version": "2.0.0", "type": "library", "abandoned": false } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test b/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test index 5b904f9b5..b63694a1e 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test @@ -50,9 +50,9 @@ update b/unstable --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library" }, - { "name": "b/unstable", "version": "1.0.0", "type": "library" }, - { "name": "c/uptodate", "version": "1.0.0", "type": "library" } + { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "c/uptodate", "version": "1.0.0", "type": "library", "abandoned": false } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test index 224e58f7d..9e4ff30e3 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test @@ -33,10 +33,10 @@ update b/unstable --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library" }, - { "name": "b/unstable", "version": "1.0.0", "type": "library" }, - { "name": "c/uptodate", "version": "1.0.0", "type": "library" }, - { "name": "d/removed", "version": "1.0.0", "type": "library" } + { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "c/uptodate", "version": "1.0.0", "type": "library", "abandoned": false }, + { "name": "d/removed", "version": "1.0.0", "type": "library", "abandoned": false } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/update-alias-lock.test b/tests/Composer/Test/Fixtures/installer/update-alias-lock.test index 0fc5fe301..256ce7e47 100644 --- a/tests/Composer/Test/Fixtures/installer/update-alias-lock.test +++ b/tests/Composer/Test/Fixtures/installer/update-alias-lock.test @@ -58,7 +58,8 @@ update "name": "a/a", "version": "dev-master", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "source": { "reference": "master", "type": "git", "url": "" }, - "type": "library" + "type": "library", + "abandoned": false } ], "packages-dev": [], @@ -70,4 +71,4 @@ update "platform-dev": [] } --EXPECT-- -Updating a/a (dev-master 1234) to a/a (dev-master master) \ No newline at end of file +Updating a/a (dev-master 1234) to a/a (dev-master master) diff --git a/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test b/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test index 849296850..aedc79fee 100644 --- a/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test +++ b/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test @@ -51,7 +51,8 @@ update "name": "a/a", "version": "dev-master", "type": "library", "source": { "reference": "newref", "url": "newurl", "type": "git" }, - "dist": { "reference": "newref", "url": "newurl", "type": "zip", "shasum": "" } + "dist": { "reference": "newref", "url": "newurl", "type": "zip", "shasum": "" }, + "abandoned": false } ], "packages-dev": [], diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php index a88ce7c21..5566e7c55 100644 --- a/tests/Composer/Test/InstallerTest.php +++ b/tests/Composer/Test/InstallerTest.php @@ -304,7 +304,7 @@ class InstallerTest extends TestCase die(sprintf('Test "%s" is not valid, did not match the expected format.', str_replace($fixturesDir.'/', '', $file))); } - $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $composer, $lock, $installed, $run, $expectLock, $expectOutput, $expect, $expectExitCode); + $tests[basename($file)] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $composer, $lock, $installed, $run, $expectLock, $expectOutput, $expect, $expectExitCode); } return $tests; From 346133d2a112dbc52163eceeee67814d351efe3f Mon Sep 17 00:00:00 2001 From: Rafael Dohms Date: Fri, 3 Oct 2014 15:12:16 +0200 Subject: [PATCH 4/4] PR Review - reverted comma removal - made getReplacementPackage consistent - removed abandoned flag if false --- src/Composer/Package/CompletePackage.php | 4 +--- src/Composer/Package/Dumper/ArrayDumper.php | 6 ++++-- .../Test/Fixtures/installer/install-dev-using-dist.test | 3 +-- ...artial-update-downgrades-non-whitelisted-unstable.test | 6 +++--- .../Test/Fixtures/installer/partial-update-from-lock.test | 6 +++--- .../Fixtures/installer/partial-update-without-lock.test | 8 ++++---- .../Test/Fixtures/installer/update-alias-lock.test | 3 +-- .../installer/updating-dev-updates-url-and-reference.test | 3 +-- tests/Composer/Test/Package/Dumper/ArrayDumperTest.php | 5 +++-- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Composer/Package/CompletePackage.php b/src/Composer/Package/CompletePackage.php index af2e2bc42..27c9abeca 100644 --- a/src/Composer/Package/CompletePackage.php +++ b/src/Composer/Package/CompletePackage.php @@ -194,8 +194,6 @@ class CompletePackage extends Package implements CompletePackageInterface */ public function getReplacementPackage() { - return $this->abandoned ?: null; + return is_string($this->abandoned)? $this->abandoned : null; } - - } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 50b2eb610..714c5183b 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -97,7 +97,7 @@ class ArrayDumper 'homepage', 'keywords', 'repositories', - 'support' + 'support', ); $data = $this->dumpValues($package, $keys, $data); @@ -106,7 +106,9 @@ class ArrayDumper sort($data['keywords']); } - $data['abandoned'] = $package->getReplacementPackage() ?: false; + if ($package->isAbandoned()) { + $data['abandoned'] = $package->getReplacementPackage() ?: true; + } } if ($package instanceof RootPackageInterface) { diff --git a/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test b/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test index 5495b60f3..af4eed811 100644 --- a/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test +++ b/tests/Composer/Test/Fixtures/installer/install-dev-using-dist.test @@ -38,8 +38,7 @@ install --prefer-dist "reference": "459720ff3b74ee0c0d159277c6f2f5df89d8a4f6", "shasum": null }, - "type": "library", - "abandoned": false + "type": "library" } ], "packages-dev": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test b/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test index dd085c5ac..f9fd5058a 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-downgrades-non-whitelisted-unstable.test @@ -50,9 +50,9 @@ update c/uptodate --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "c/uptodate", "version": "2.0.0", "type": "library", "abandoned": false } + { "name": "a/old", "version": "1.0.0", "type": "library" }, + { "name": "b/unstable", "version": "1.0.0", "type": "library" }, + { "name": "c/uptodate", "version": "2.0.0", "type": "library" } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test b/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test index b63694a1e..5b904f9b5 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-from-lock.test @@ -50,9 +50,9 @@ update b/unstable --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "c/uptodate", "version": "1.0.0", "type": "library", "abandoned": false } + { "name": "a/old", "version": "1.0.0", "type": "library" }, + { "name": "b/unstable", "version": "1.0.0", "type": "library" }, + { "name": "c/uptodate", "version": "1.0.0", "type": "library" } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test index 9e4ff30e3..224e58f7d 100644 --- a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test +++ b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test @@ -33,10 +33,10 @@ update b/unstable --EXPECT-LOCK-- { "packages": [ - { "name": "a/old", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "b/unstable", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "c/uptodate", "version": "1.0.0", "type": "library", "abandoned": false }, - { "name": "d/removed", "version": "1.0.0", "type": "library", "abandoned": false } + { "name": "a/old", "version": "1.0.0", "type": "library" }, + { "name": "b/unstable", "version": "1.0.0", "type": "library" }, + { "name": "c/uptodate", "version": "1.0.0", "type": "library" }, + { "name": "d/removed", "version": "1.0.0", "type": "library" } ], "packages-dev": [], "aliases": [], diff --git a/tests/Composer/Test/Fixtures/installer/update-alias-lock.test b/tests/Composer/Test/Fixtures/installer/update-alias-lock.test index 256ce7e47..bfe0bb8a8 100644 --- a/tests/Composer/Test/Fixtures/installer/update-alias-lock.test +++ b/tests/Composer/Test/Fixtures/installer/update-alias-lock.test @@ -58,8 +58,7 @@ update "name": "a/a", "version": "dev-master", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "source": { "reference": "master", "type": "git", "url": "" }, - "type": "library", - "abandoned": false + "type": "library" } ], "packages-dev": [], diff --git a/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test b/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test index aedc79fee..849296850 100644 --- a/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test +++ b/tests/Composer/Test/Fixtures/installer/updating-dev-updates-url-and-reference.test @@ -51,8 +51,7 @@ update "name": "a/a", "version": "dev-master", "type": "library", "source": { "reference": "newref", "url": "newurl", "type": "git" }, - "dist": { "reference": "newref", "url": "newurl", "type": "zip", "shasum": "" }, - "abandoned": false + "dist": { "reference": "newref", "url": "newurl", "type": "zip", "shasum": "" } } ], "packages-dev": [], diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php index 656ec96bc..f1889a1ce 100644 --- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php +++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php @@ -45,8 +45,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase array( 'name' => 'foo', 'version' => '1.0', - 'version_normalized' => '1.0.0.0', - 'abandoned' => false + 'version_normalized' => '1.0.0.0' ), $config ); @@ -65,6 +64,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase public function testDumpAbandoned() { + $this->packageExpects('isAbandoned', true); $this->packageExpects('getReplacementPackage', true); $config = $this->dumper->dump($this->package); @@ -74,6 +74,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase public function testDumpAbandonedReplacement() { + $this->packageExpects('isAbandoned', true); $this->packageExpects('getReplacementPackage', 'foo/bar'); $config = $this->dumper->dump($this->package);