From 082695e79b8121023b32379e6c658cc0c7d42958 Mon Sep 17 00:00:00 2001 From: Brent Roose Date: Tue, 29 Oct 2024 13:13:51 +0100 Subject: [PATCH] Add failing test --- .../Console/CommandWithArgumentName.php | 24 +++++++++++++++++++ .../Console/ConsoleArgumentBagTest.php | 11 +++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tests/Fixtures/Console/CommandWithArgumentName.php diff --git a/tests/Fixtures/Console/CommandWithArgumentName.php b/tests/Fixtures/Console/CommandWithArgumentName.php new file mode 100644 index 000000000..f0143169b --- /dev/null +++ b/tests/Fixtures/Console/CommandWithArgumentName.php @@ -0,0 +1,24 @@ +writeln($input); + $this->writeln($flag ? 'true' : 'false'); + } +} \ No newline at end of file diff --git a/tests/Integration/Console/ConsoleArgumentBagTest.php b/tests/Integration/Console/ConsoleArgumentBagTest.php index 21866ff8d..5935f3c79 100644 --- a/tests/Integration/Console/ConsoleArgumentBagTest.php +++ b/tests/Integration/Console/ConsoleArgumentBagTest.php @@ -54,8 +54,7 @@ public function test_positional_vs_named_input(): void $this->console ->call('complex a --c=c --b=b --flag') ->assertContains('abc') - ->assertContains('true') - ; + ->assertContains('true'); } public function test_combined_flags(): void @@ -138,4 +137,12 @@ public function test_negative_input(string $name, bool $expected): void $this->assertSame($expected, $bag->findFor($definition)->value); } + + public function test_name_mapping(): void + { + $this->console + ->call('command-with-argument-name --new-name=foo --new-flag') + ->assertSee('foo') + ->assertSee('true'); + } }