[TASK] Deprecate methods in ReflectionService
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Mvc / Cli / RequestBuilderTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
3
4 /* *
5 * This script belongs to the Extbase framework. *
6 * *
7 * It is free software; you can redistribute it and/or modify it under *
8 * the terms of the GNU Lesser General Public License as published by the *
9 * Free Software Foundation, either version 3 of the License, or (at your *
10 * option) any later version. *
11 * *
12 * This script is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
14 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
15 * General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with the script. *
19 * If not, see http://www.gnu.org/licenses/lgpl.html *
20 * *
21 * The TYPO3 project - inspiring people to share! *
22 * */
23 use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException;
24 use TYPO3\CMS\Extbase\Reflection\ClassSchema;
25
26 /**
27 * Test case
28 */
29 class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
30 {
31 /**
32 * @var \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit_Framework_Comparator_MockObject
33 */
34 protected $requestBuilder;
35
36 /**
37 * @var \TYPO3\CMS\Extbase\Mvc\Cli\Request|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
38 */
39 protected $request;
40
41 /**
42 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
43 */
44 protected $mockObjectManager;
45
46 /**
47 * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command
48 */
49 protected $mockCommand;
50
51 /**
52 * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
53 */
54 protected $mockCommandManager;
55
56 /**
57 * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService|\PHPUnit_Framework_MockObject_MockObject
58 */
59 protected $mockReflectionService;
60
61 /**
62 * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface|\PHPUnit_Framework_MockObject_MockObject
63 */
64 protected $mockConfigurationManager;
65
66 /**
67 * Sets up this test case
68 */
69 protected function setUp()
70 {
71 $this->request = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class, ['dummy']);
72 $this->mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
73 $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class)->will($this->returnValue($this->request));
74 $this->mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
75 $this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Tx\\SomeExtensionName\\Command\\DefaultCommandController'));
76 $this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
77 $this->mockCommandManager = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
78 $this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('some_extension_name:default:list')->will($this->returnValue($this->mockCommand));
79 $this->mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
80 $this->mockConfigurationManager = $this->createMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
81 $this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::class, ['dummy']);
82 $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
83 $this->requestBuilder->_set('reflectionService', $this->mockReflectionService);
84 $this->requestBuilder->_set('commandManager', $this->mockCommandManager);
85 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
86 }
87
88 /**
89 * Checks if a CLI request specifying a package, controller and action name results in the expected request object
90 *
91 * @test
92 */
93 public function cliAccessWithExtensionControllerAndActionNameBuildsCorrectRequest(): void
94 {
95 $classSchemaMock = $this->createMock(ClassSchema::class);
96 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
97 'params' => []
98 ]);
99
100 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
101 $request = $this->requestBuilder->build('some_extension_name:default:list');
102 $this->assertSame('Tx\\SomeExtensionName\\Command\\DefaultCommandController', $request->getControllerObjectName());
103 $this->assertSame('list', $request->getControllerCommandName(), 'The CLI request specifying a package, controller and action name did not return a request object pointing to the expected action.');
104 }
105
106 /**
107 * @test
108 */
109 public function ifCommandCantBeResolvedTheHelpScreenIsShown()
110 {
111 // The following call is only made to satisfy PHPUnit. For some weird reason PHPUnit complains that the
112 // mocked method ("getObjectNameByClassName") does not exist _if the mock object is not used_.
113 $this->mockCommandManager->getCommandByIdentifier('some_extension_name:default:list');
114 $mockCommandManager = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
115 $mockCommandManager
116 ->expects($this->any())
117 ->method('getCommandByIdentifier')
118 ->with('test:default:list')
119 ->will(
120 $this->throwException(
121 new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException('testing', 1476050312)
122 )
123 );
124 $this->requestBuilder->_set('commandManager', $mockCommandManager);
125 $request = $this->requestBuilder->build('test:default:list');
126 $this->assertSame(\TYPO3\CMS\Extbase\Command\HelpCommandController::class, $request->getControllerObjectName());
127 }
128
129 /**
130 * @test
131 */
132 public function argumentWithValueSeparatedByEqualSignBuildsCorrectRequest(): void
133 {
134 $methodParameters = [
135 'testArgument' => ['optional' => false, 'type' => 'string']
136 ];
137
138 $classSchemaMock = $this->createMock(ClassSchema::class);
139 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
140 'params' => $methodParameters
141 ]);
142
143 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
144 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value');
145 $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
146 $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
147 }
148
149 /**
150 * Checks if a CLI request specifying some "console style" (--my-argument=value) arguments results in the expected request object
151 *
152 * @test
153 */
154 public function cliAccessWithExtensionControllerActionAndArgumentsBuildsCorrectRequest(): void
155 {
156 $methodParameters = [
157 'testArgument' => ['optional' => false, 'type' => 'string'],
158 'testArgument2' => ['optional' => false, 'type' => 'string']
159 ];
160
161 $classSchemaMock = $this->createMock(ClassSchema::class);
162 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
163 'params' => $methodParameters
164 ]);
165
166 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
167 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value --test-argument2=value2');
168 $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
169 $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
170 $this->assertEquals($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
171 $this->assertEquals($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
172 }
173
174 /**
175 * Checks if a CLI request specifying some "console style" (--my-argument =value) arguments with spaces between name and value results in the expected request object
176 *
177 * @test
178 */
179 public function checkIfCLIAccesWithPackageControllerActionAndArgumentsToleratesSpaces(): void
180 {
181 $methodParameters = [
182 'testArgument' => ['optional' => false, 'type' => 'string'],
183 'testArgument2' => ['optional' => false, 'type' => 'string'],
184 'testArgument3' => ['optional' => false, 'type' => 'string'],
185 'testArgument4' => ['optional' => false, 'type' => 'string']
186 ];
187
188 $classSchemaMock = $this->createMock(ClassSchema::class);
189 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
190 'params' => $methodParameters
191 ]);
192
193 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
194 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument= value --test-argument2 =value2 --test-argument3 = value3 --test-argument4=value4');
195 $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
196 $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
197 $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
198 $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
199 $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
200 $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
201 $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
202 $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
203 }
204
205 /**
206 * Checks if a CLI request specifying some short "console style" (-c value or -c=value or -c = value) arguments results in the expected request object
207 *
208 * @test
209 */
210 public function CLIAccesWithShortArgumentsBuildsCorrectRequest(): void
211 {
212 $methodParameters = [
213 'a' => ['optional' => false, 'type' => 'string'],
214 'd' => ['optional' => false, 'type' => 'string'],
215 'f' => ['optional' => false, 'type' => 'string']
216 ];
217
218 $classSchemaMock = $this->createMock(ClassSchema::class);
219 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
220 'params' => $methodParameters
221 ]);
222
223 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
224
225 $request = $this->requestBuilder->build('some_extension_name:default:list -d valued -f=valuef -a = valuea');
226 $this->assertTrue($request->hasArgument('d'), 'The given "d" was not found in the built request.');
227 $this->assertTrue($request->hasArgument('f'), 'The given "f" was not found in the built request.');
228 $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
229 $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
230 $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
231 $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
232 }
233
234 /**
235 * Checks if a CLI request specifying some mixed "console style" (-c or --my-argument -f=value) arguments with and
236 * without values results in the expected request object
237 *
238 * @test
239 */
240 public function CLIAccesWithArgumentsWithAndWithoutValuesBuildsCorrectRequest(): void
241 {
242 $methodParameters = [
243 'testArgument' => ['optional' => false, 'type' => 'string'],
244 'testArgument2' => ['optional' => false, 'type' => 'string'],
245 'testArgument3' => ['optional' => false, 'type' => 'string'],
246 'testArgument4' => ['optional' => false, 'type' => 'string'],
247 'testArgument5' => ['optional' => false, 'type' => 'string'],
248 'testArgument6' => ['optional' => false, 'type' => 'string'],
249 'testArgument7' => ['optional' => false, 'type' => 'string'],
250 'f' => ['optional' => false, 'type' => 'string'],
251 'd' => ['optional' => false, 'type' => 'string'],
252 'a' => ['optional' => false, 'type' => 'string'],
253 'c' => ['optional' => false, 'type' => 'string'],
254 'j' => ['optional' => false, 'type' => 'string'],
255 'k' => ['optional' => false, 'type' => 'string'],
256 'm' => ['optional' => false, 'type' => 'string']
257 ];
258
259 $classSchemaMock = $this->createMock(ClassSchema::class);
260 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
261 'params' => $methodParameters
262 ]);
263
264 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
265
266 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value --test-argument2= value2 -k --test-argument-3 = value3 --test-argument4=value4 -f valuef -d=valued -a = valuea -c --testArgument7 --test-argument5 = 5 --test-argument6 -j kjk -m');
267 $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
268 $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
269 $this->assertTrue($request->hasArgument('k'), 'The given "k" was not found in the built request.');
270 $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
271 $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
272 $this->assertTrue($request->hasArgument('f'), 'The given "f" was not found in the built request.');
273 $this->assertTrue($request->hasArgument('d'), 'The given "d" was not found in the built request.');
274 $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
275 $this->assertTrue($request->hasArgument('c'), 'The given "d" was not found in the built request.');
276 $this->assertTrue($request->hasArgument('testArgument7'), 'The given "testArgument7" was not found in the built request.');
277 $this->assertTrue($request->hasArgument('testArgument5'), 'The given "testArgument5" was not found in the built request.');
278 $this->assertTrue($request->hasArgument('testArgument6'), 'The given "testArgument6" was not found in the built request.');
279 $this->assertTrue($request->hasArgument('j'), 'The given "j" was not found in the built request.');
280 $this->assertTrue($request->hasArgument('m'), 'The given "m" was not found in the built request.');
281 $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
282 $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
283 $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
284 $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
285 $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
286 $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
287 $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
288 $this->assertSame($request->getArgument('testArgument5'), '5', 'The "testArgument4" had not the given value.');
289 $this->assertSame($request->getArgument('j'), 'kjk', 'The "j" had not the given value.');
290 }
291
292 /**
293 * @test
294 */
295 public function insteadOfNamedArgumentsTheArgumentsCanBePassedUnnamedInTheCorrectOrder(): void
296 {
297 $methodParameters = [
298 'testArgument1' => ['optional' => false, 'type' => 'string'],
299 'testArgument2' => ['optional' => false, 'type' => 'string']
300 ];
301
302 $classSchemaMock = $this->createMock(ClassSchema::class);
303 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
304 'params' => $methodParameters
305 ]);
306
307 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
308 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument1 firstArgumentValue --test-argument2 secondArgumentValue');
309 $this->assertSame('firstArgumentValue', $request->getArgument('testArgument1'));
310 $this->assertSame('secondArgumentValue', $request->getArgument('testArgument2'));
311 $request = $this->requestBuilder->build('some_extension_name:default:list firstArgumentValue secondArgumentValue');
312 $this->assertSame('firstArgumentValue', $request->getArgument('testArgument1'));
313 $this->assertSame('secondArgumentValue', $request->getArgument('testArgument2'));
314 }
315
316 /**
317 * @test
318 */
319 public function argumentsAreDetectedAfterOptions(): void
320 {
321 $methodParameters = [
322 'some' => ['optional' => true, 'type' => 'boolean'],
323 'option' => ['optional' => true, 'type' => 'string'],
324 'argument1' => ['optional' => false, 'type' => 'string'],
325 'argument2' => ['optional' => false, 'type' => 'string']
326 ];
327
328 $classSchemaMock = $this->createMock(ClassSchema::class);
329 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
330 'params' => $methodParameters
331 ]);
332
333 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
334 $request = $this->requestBuilder->build('some_extension_name:default:list --some -option=value file1 file2');
335 $this->assertSame('list', $request->getControllerCommandName());
336 $this->assertTrue($request->getArgument('some'));
337 $this->assertSame('file1', $request->getArgument('argument1'));
338 $this->assertSame('file2', $request->getArgument('argument2'));
339 }
340
341 /**
342 * @test
343 */
344 public function exceedingArgumentsMayBeSpecified(): void
345 {
346 $methodParameters = [
347 'testArgument1' => ['optional' => false, 'type' => 'string'],
348 'testArgument2' => ['optional' => false, 'type' => 'string']
349 ];
350
351 $classSchemaMock = $this->createMock(ClassSchema::class);
352 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
353 'params' => $methodParameters
354 ]);
355
356 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
357
358 $expectedArguments = ['testArgument1' => 'firstArgumentValue', 'testArgument2' => 'secondArgumentValue'];
359 $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument1=firstArgumentValue --test-argument2 secondArgumentValue exceedingArgument1');
360 $this->assertEquals($expectedArguments, $request->getArguments());
361 $this->assertEquals(['exceedingArgument1'], $request->getExceedingArguments());
362 }
363
364 /**
365 * @test
366 */
367 public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed(): void
368 {
369 $this->expectException(InvalidArgumentMixingException::class);
370 $this->expectExceptionCode(1309971820);
371 $methodParameters = [
372 'testArgument1' => ['optional' => false, 'type' => 'string'],
373 'testArgument2' => ['optional' => false, 'type' => 'string']
374 ];
375
376 $classSchemaMock = $this->createMock(ClassSchema::class);
377 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
378 'params' => $methodParameters
379 ]);
380
381 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
382
383 $this->requestBuilder->build('some_extension_name:default:list --test-argument1 firstArgumentValue secondArgumentValue');
384 }
385
386 /**
387 * @test
388 */
389 public function ifUnnamedArgumentsAreUsedAllRequiredArgumentsMustBeUnnamed(): void
390 {
391 $this->expectException(InvalidArgumentMixingException::class);
392 $this->expectExceptionCode(1309971821);
393 $methodParameters = [
394 'requiredArgument1' => ['optional' => false, 'type' => 'string'],
395 'requiredArgument2' => ['optional' => false, 'type' => 'string']
396 ];
397
398 $classSchemaMock = $this->createMock(ClassSchema::class);
399 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
400 'params' => $methodParameters
401 ]);
402
403 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
404
405 $this->requestBuilder->build('some_extension_name:default:list firstArgumentValue --required-argument2 secondArgumentValue');
406 }
407
408 /**
409 * @test
410 */
411 public function booleanOptionsAreConsideredEvenIfAnUnnamedArgumentFollows(): void
412 {
413 $methodParameters = [
414 'requiredArgument1' => ['optional' => false, 'type' => 'string'],
415 'requiredArgument2' => ['optional' => false, 'type' => 'string'],
416 'booleanOption' => ['optional' => true, 'type' => 'boolean']
417 ];
418
419 $classSchemaMock = $this->createMock(ClassSchema::class);
420 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
421 'params' => $methodParameters
422 ]);
423
424 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
425
426 $expectedArguments = ['requiredArgument1' => 'firstArgumentValue', 'requiredArgument2' => 'secondArgumentValue', 'booleanOption' => true];
427 $request = $this->requestBuilder->build('some_extension_name:default:list --booleanOption firstArgumentValue secondArgumentValue');
428 $this->assertEquals($expectedArguments, $request->getArguments());
429 }
430
431 /**
432 * @test
433 */
434 public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign(): void
435 {
436 $methodParameters = [
437 'b1' => ['optional' => true, 'type' => 'boolean'],
438 'b2' => ['optional' => true, 'type' => 'boolean'],
439 'b3' => ['optional' => true, 'type' => 'boolean'],
440 'b4' => ['optional' => true, 'type' => 'boolean'],
441 'b5' => ['optional' => true, 'type' => 'boolean'],
442 'b6' => ['optional' => true, 'type' => 'boolean']
443 ];
444
445 $classSchemaMock = $this->createMock(ClassSchema::class);
446 $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
447 'params' => $methodParameters
448 ]);
449
450 $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
451
452 $expectedArguments = ['b1' => true, 'b2' => true, 'b3' => true, 'b4' => false, 'b5' => false, 'b6' => false];
453 $request = $this->requestBuilder->build('some_extension_name:default:list --b2 y --b1 1 --b3 true --b4 false --b5 n --b6 0');
454 $this->assertEquals($expectedArguments, $request->getArguments());
455 }
456 }