Skip to content

Commit e8c91f3

Browse files
committed
test: add test for CLIRequest::getArgs()
1 parent 6707697 commit e8c91f3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/system/HTTP/CLIRequestTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,34 @@ public function testParsingNoOptions()
138138
$this->assertSame($expected, $this->request->getOptionString());
139139
}
140140

141+
public function testParsingArgs()
142+
{
143+
$_SERVER['argv'] = [
144+
'spark',
145+
'command',
146+
'param1',
147+
'param2',
148+
'--opt1',
149+
'opt1val',
150+
'--opt-2',
151+
'opt 2 val',
152+
'param3',
153+
];
154+
155+
// reinstantiate it to force parsing
156+
$this->request = new CLIRequest(new App());
157+
158+
$options = [
159+
'command',
160+
'param1',
161+
'param2',
162+
'opt1' => 'opt1val',
163+
'opt-2' => 'opt 2 val',
164+
'param3',
165+
];
166+
$this->assertSame($options, $this->request->getArgs());
167+
}
168+
141169
public function testParsingPath()
142170
{
143171
$_SERVER['argv'] = [

0 commit comments

Comments
 (0)