From aaff0ae4df7bcd44ec4c293daf0047e8c8b0c7e9 Mon Sep 17 00:00:00 2001 From: theoboldalex <44616505+theoboldalex@users.noreply.github.com> Date: Fri, 8 Dec 2023 17:26:05 +0000 Subject: [PATCH] Adds a test for UpdateCommand (#11724) * test: Interactive mode should throw if no package * PHPStan fix. Missing return type on test method --- tests/Composer/Test/Command/UpdateCommandTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Composer/Test/Command/UpdateCommandTest.php b/tests/Composer/Test/Command/UpdateCommandTest.php index 5564eafae..cf84015e1 100644 --- a/tests/Composer/Test/Command/UpdateCommandTest.php +++ b/tests/Composer/Test/Command/UpdateCommandTest.php @@ -13,6 +13,7 @@ namespace Composer\Test\Command; use Composer\Test\TestCase; +use InvalidArgumentException; class UpdateCommandTest extends TestCase { @@ -101,4 +102,14 @@ Run `composer require root/req` or `composer require root/req:^2` instead to rep OUTPUT ]; } + + public function testInteractiveModeThrowsIfNoPackageEntered(): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('You must enter minimum one package.'); + + $appTester = $this->getApplicationTester(); + $appTester->setInputs(['']); + $appTester->run(['command' => 'update', '--interactive' => true]); + } }