From 3be0ca84679bef00d3c16472d258bb88d12b23f6 Mon Sep 17 00:00:00 2001 From: theoboldalex <44616505+theoboldalex@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:03:34 +0000 Subject: [PATCH] Adds a test for invalid arg combo (#11783) --- tests/Composer/Test/Command/ConfigCommandTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Composer/Test/Command/ConfigCommandTest.php b/tests/Composer/Test/Command/ConfigCommandTest.php index 10dd170f2..68653c622 100644 --- a/tests/Composer/Test/Command/ConfigCommandTest.php +++ b/tests/Composer/Test/Command/ConfigCommandTest.php @@ -13,6 +13,7 @@ namespace Composer\Test\Command; use Composer\Test\TestCase; +use RuntimeException; class ConfigCommandTest extends TestCase { @@ -139,4 +140,13 @@ class ConfigCommandTest extends TestCase '{"foo":{"type":"vcs","url":"https://example.org"}}', ]; } + + public function testConfigThrowsForInvalidArgCombination(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('--file and --global can not be combined'); + + $appTester = $this->getApplicationTester(); + $appTester->run(['command' => 'config', '--file' => 'alt.composer.json', '--global' => true]); + } }