Skip to content

Commit 29ca631

Browse files
committed
test: args()
1 parent d4b716d commit 29ca631

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/ArgvParserTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function test_arguments_with_options()
8787
public function test_options_repeat()
8888
{
8989
$this->expectException(\InvalidArgumentException::class);
90-
$this->expectExceptionMessage('The option "--apple" is already registered');
90+
$this->expectExceptionMessage('The parameter "--apple" is already registered');
9191

9292
$p = $this->newParser()->option('-a --apple', 'Apple')->option('-a --apple', 'Apple');
9393
}
@@ -203,6 +203,14 @@ public function test_no_value()
203203
$this->assertNull($p->xyz);
204204
}
205205

206+
public function test_args()
207+
{
208+
$p = $this->newParser()->arguments('<a> [b]')->option('-x --xyz')
209+
->parse(['php', 'A', '-x', 'X', 'B', 'C', 'D']);
210+
211+
$this->assertSame(['a' => 'A', 'b' => 'B', 'C', 'D'], $p->args());
212+
}
213+
206214
protected function newParser(string $version = '0.0.1', string $desc = null, bool $allowUnknown = false)
207215
{
208216
$p = new ArgvParser('ArgvParserTest', $desc, $allowUnknown);

0 commit comments

Comments
 (0)