1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 00:53:06 +00:00

Improve interactive package updates (#11990)

* Improve interactive package updates

* Exclude platform packages and up to date packages, follow stability flags, ignore-platform-reqs etc

* Add tests and support for lock file + empty lock/vendor

---------

Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
This commit is contained in:
Job Vink 2024-09-18 10:43:42 +02:00 committed by GitHub
parent 12031542ba
commit be7d9abc66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 94 additions and 35 deletions

View file

@ -128,10 +128,47 @@ OUTPUT
];
}
public function testInteractiveModeThrowsIfNoPackageToUpdate(): void
{
$this->initTempComposer([
'repositories' => [
'packages' => [
'type' => 'package',
'package' => [
['name' => 'root/req', 'version' => '1.0.0'],
],
],
],
'require' => [
'root/req' => '1.*',
],
]);
$this->createComposerLock([self::getPackage('root/req', '1.0.0')]);
self::expectExceptionMessage('Could not find any package with new versions available');
$appTester = $this->getApplicationTester();
$appTester->setInputs(['']);
$appTester->run(['command' => 'update', '--interactive' => true]);
}
public function testInteractiveModeThrowsIfNoPackageEntered(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('You must enter minimum one package.');
$this->initTempComposer([
'repositories' => [
'packages' => [
'type' => 'package',
'package' => [
['name' => 'root/req', 'version' => '1.0.0'],
['name' => 'root/req', 'version' => '1.0.1'],
],
],
],
'require' => [
'root/req' => '1.*',
],
]);
$this->createComposerLock([self::getPackage('root/req', '1.0.0')]);
self::expectExceptionMessage('No package named "" is installed.');
$appTester = $this->getApplicationTester();
$appTester->setInputs(['']);