File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -339,15 +339,18 @@ private function toInternalFormat(array $options): array
339
339
$ formattedOptions = [];
340
340
foreach ($ options as $ option => $ arguments ) {
341
341
$ option = trim ((string )$ option );
342
+
342
343
if (strpos ($ option , '- ' ) !== 0 ) {
343
344
// ['-L', '-v']
344
- $ formattedOptions [$ arguments ] = [null ];
345
+ $ option = (string )$ arguments ;
346
+ $ arguments = [null ];
345
347
} elseif (!is_array ($ arguments )) {
346
348
// ['-L' => null, '-v' => null]
347
- $ formattedOptions [$ option ] = [$ arguments ];
348
- } else {
349
- // internal format
350
- $ formattedOptions [$ option ] = $ arguments ;
349
+ $ arguments = [$ arguments ];
350
+ }
351
+
352
+ foreach ($ arguments as $ argument ) {
353
+ $ formattedOptions [$ option ][] = $ argument ;
351
354
}
352
355
}
353
356
Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ public function testBuildDuplicatedOptions(): void
97
97
$ this ->assertSame ('curl -v -L -L http://example.com ' , $ command ->build ());
98
98
}
99
99
100
+ public function testBuildDuplicatedOptionsAddOptions (): void
101
+ {
102
+ $ command = $ this ->getNewCommand ();
103
+ $ command ->addOptions (['-v ' , '-v ' ]);
104
+ $ this ->assertSame ('curl -v -v http://example.com ' , $ command ->build ());
105
+ }
106
+
107
+ public function testBuildDuplicatedOptionsSetOptions (): void
108
+ {
109
+ $ command = $ this ->getNewCommand ();
110
+ $ command ->setOptions (['-v ' , '-v ' ]);
111
+ $ this ->assertSame ('curl -v -v http://example.com ' , $ command ->build ());
112
+ }
113
+
100
114
public function testBuildSetTemplate (): void
101
115
{
102
116
$ command = $ this ->getNewCommand ();
You can’t perform that action at this time.
0 commit comments