[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Mvc / Web / RequestBuilderTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Web;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Test case
19 */
20 class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
24 */
25 protected $requestBuilder;
26
27 /**
28 * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface|\PHPUnit_Framework_MockObject_MockObject
29 */
30 protected $mockConfigurationManager;
31
32 /**
33 * @var array
34 */
35 protected $configuration;
36
37 /**
38 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
39 */
40 protected $mockObjectManager;
41
42 /**
43 * @var \TYPO3\CMS\Extbase\Service\ExtensionService|\PHPUnit_Framework_MockObject_MockObject
44 */
45 protected $mockExtensionService;
46
47 /**
48 * @var \TYPO3\CMS\Extbase\Service\EnvironmentService|\PHPUnit_Framework_MockObject_MockObject
49 */
50 protected $mockEnvironmentService;
51
52 /**
53 * @var \TYPO3\CMS\Extbase\Mvc\Web\Request|\PHPUnit_Framework_MockObject_MockObject
54 */
55 protected $mockRequest;
56
57 public function setUp() {
58 $this->requestBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\RequestBuilder', array('dummy'));
59 $this->configuration = array(
60 'userFunc' => 'Tx_Extbase_Dispatcher->dispatch',
61 'pluginName' => 'Pi1',
62 'extensionName' => 'MyExtension',
63 'controller' => 'TheFirstController',
64 'action' => 'show',
65 'controllerConfiguration' => array(
66 'TheFirstController' => array(
67 'actions' => array('show', 'index', 'new', 'create', 'delete', 'edit', 'update', 'setup', 'test')
68 ),
69 'TheSecondController' => array(
70 'actions' => array('show', 'index')
71 ),
72 'TheThirdController' => array(
73 'actions' => array('delete', 'create', 'onlyInThirdController')
74 )
75 )
76 );
77 $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
78 $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
79 $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
80 $this->mockExtensionService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\ExtensionService');
81 $this->mockEnvironmentService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array('getServerRequestMethod'));
82 }
83
84 /**
85 * @return void
86 */
87 protected function injectDependencies() {
88 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
89 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
90 $this->mockObjectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request')->will($this->returnValue($this->mockRequest));
91 $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
92 $pluginNamespace = 'tx_' . strtolower(($this->configuration['extensionName'] . '_' . $this->configuration['pluginName']));
93 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue($pluginNamespace));
94 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
95 $this->mockEnvironmentService->expects($this->any())->method('getServerRequestMethod')->will($this->returnValue('GET'));
96 $this->requestBuilder->_set('environmentService', $this->mockEnvironmentService);
97 }
98
99 /**
100 * @test
101 */
102 public function buildReturnsAWebRequestObject() {
103 $this->injectDependencies();
104 $request = $this->requestBuilder->build();
105 $this->assertSame($this->mockRequest, $request);
106 }
107
108 /**
109 * @test
110 */
111 public function buildSetsRequestPluginName() {
112 $this->injectDependencies();
113 $this->mockRequest->expects($this->once())->method('setPluginName')->with('Pi1');
114 $this->requestBuilder->build();
115 }
116
117 /**
118 * @test
119 */
120 public function buildSetsRequestControllerExtensionName() {
121 $this->injectDependencies();
122 $this->mockRequest->expects($this->once())->method('setControllerExtensionName')->with('MyExtension');
123 $this->requestBuilder->build();
124 }
125
126 /**
127 * @test
128 */
129 public function buildSetsRequestControllerName() {
130 $this->injectDependencies();
131 $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheFirstController');
132 $this->requestBuilder->build();
133 }
134
135 /**
136 * @test
137 */
138 public function buildSetsRequestControllerActionName() {
139 $this->injectDependencies();
140 $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('show');
141 $this->requestBuilder->build();
142 }
143
144 /**
145 * @test
146 */
147 public function buildSetsRequestRequestUri() {
148 $this->injectDependencies();
149 $expectedRequestUri = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
150 $this->mockRequest->expects($this->once())->method('setRequestUri')->with($expectedRequestUri);
151 $this->requestBuilder->build();
152 }
153
154 /**
155 * @test
156 */
157 public function buildSetsRequestBaseUri() {
158 $this->injectDependencies();
159 $expectedBaseUri = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
160 $this->mockRequest->expects($this->once())->method('setBaseUri')->with($expectedBaseUri);
161 $this->requestBuilder->build();
162 }
163
164 /**
165 * @test
166 */
167 public function buildSetsRequestMethod() {
168 $this->injectDependencies();
169 $expectedMethod = 'SomeRequestMethod';
170 $mockEnvironmentService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array('getServerRequestMethod'));
171 $mockEnvironmentService->expects($this->once())->method('getServerRequestMethod')->will($this->returnValue($expectedMethod));
172 $this->requestBuilder->_set('environmentService', $mockEnvironmentService);
173 $this->mockRequest->expects($this->once())->method('setMethod')->with($expectedMethod);
174 $this->requestBuilder->build();
175 }
176
177 /**
178 * @test
179 */
180 public function buildSetsVendorNameIfConfigured() {
181 $this->injectDependencies();
182 $expectedVendor = 'Vendor';
183 $this->configuration['vendorName'] = $expectedVendor;
184 $mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
185 $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
186 $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
187 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
188 $this->mockRequest->expects($this->once())->method('setControllerVendorName')->with($expectedVendor);
189 $this->requestBuilder->build();
190 }
191
192 /**
193 * @test
194 */
195 public function buildDoesNotSetVendorNameIfNotConfiguredInSecondRequest() {
196 $this->injectDependencies();
197 $expectedVendor = 'Vendor';
198 $this->configuration['vendorName'] = $expectedVendor;
199
200 $mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
201 $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
202 $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
203 $this->mockRequest->expects($this->once())->method('setControllerVendorName')->with($expectedVendor);
204
205 $this->requestBuilder->build();
206
207 unset($this->configuration['vendorName']);
208 $mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
209 $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
210 $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
211
212 $this->mockRequest->expects($this->never())->method('setControllerVendorName');
213 $this->requestBuilder->build();
214 }
215
216 /**
217 * @test
218 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
219 */
220 public function buildThrowsExceptionIfExtensionNameIsNotConfigured() {
221 unset($this->configuration['extensionName']);
222 $mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
223 $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
224 $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
225 $this->requestBuilder->build();
226 }
227
228 /**
229 * @test
230 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
231 */
232 public function buildThrowsExceptionIfPluginNameIsNotConfigured() {
233 unset($this->configuration['pluginName']);
234 $mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
235 $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
236 $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
237 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
238 $this->requestBuilder->build();
239 }
240
241 /**
242 * @test
243 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
244 */
245 public function buildThrowsExceptionIfControllerConfigurationIsEmptyOrNotSet() {
246 $this->configuration['controllerConfiguration'] = array();
247 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
248 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
249 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
250 $this->requestBuilder->build();
251 }
252
253 /**
254 * @test
255 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
256 */
257 public function buildThrowsExceptionIfControllerConfigurationHasNoDefaultActionDefined() {
258 $this->configuration['controllerConfiguration']['TheFirstController'] = array();
259 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
260 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
261 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
262 $this->requestBuilder->build();
263 }
264
265 /**
266 * @test
267 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
268 */
269 public function buildThrowsExceptionIfNoDefaultControllerCanBeResolved() {
270 $this->configuration['controllerConfiguration'] = array(
271 '' => array(
272 'actions' => array('foo')
273 )
274 );
275 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
276 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
277 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
278 $this->requestBuilder->build();
279 }
280
281 /**
282 * @test
283 */
284 public function buildSetsParametersFromGetAndPostVariables() {
285 $this->configuration['extensionName'] = 'SomeExtensionName';
286 $this->configuration['pluginName'] = 'SomePluginName';
287 $this->injectDependencies();
288 $_GET = array(
289 'tx_someotherextensionname_somepluginname' => array(
290 'foo' => 'bar'
291 ),
292 'tx_someextensionname_somepluginname' => array(
293 'parameter1' => 'valueGetsOverwritten',
294 'parameter2' => array(
295 'parameter3' => 'value3'
296 )
297 )
298 );
299 $_POST = array(
300 'tx_someextensionname_someotherpluginname' => array(
301 'foo' => 'bar'
302 ),
303 'tx_someextensionname_somepluginname' => array(
304 'parameter1' => 'value1',
305 'parameter2' => array(
306 'parameter4' => 'value4'
307 )
308 )
309 );
310 $this->mockRequest->expects($this->at(8))->method('setArgument')->with('parameter1', 'value1');
311 $this->mockRequest->expects($this->at(9))->method('setArgument')->with('parameter2', array('parameter3' => 'value3', 'parameter4' => 'value4'));
312 $this->requestBuilder->build();
313 }
314
315 /**
316 * @test
317 */
318 public function buildSetsFormatFromGetAndPostVariables() {
319 $this->configuration['extensionName'] = 'SomeExtensionName';
320 $this->configuration['pluginName'] = 'SomePluginName';
321 $this->injectDependencies();
322 $_GET = array(
323 'tx_someextensionname_somepluginname' => array(
324 'format' => 'GET'
325 )
326 );
327 $_POST = array(
328 'tx_someextensionname_somepluginname' => array(
329 'format' => 'POST'
330 )
331 );
332 $this->mockRequest->expects($this->at(7))->method('setFormat')->with('POST');
333 $this->requestBuilder->build();
334 }
335
336 /**
337 * @test
338 */
339 public function buildCorrectlySetsAllowedControllerActions() {
340 $this->injectDependencies();
341 $expectedResult = array(
342 'TheFirstController' => array(
343 'show',
344 'index',
345 'new',
346 'create',
347 'delete',
348 'edit',
349 'update',
350 'setup',
351 'test'
352 ),
353 'TheSecondController' => array(
354 'show',
355 'index'
356 ),
357 'TheThirdController' => array(
358 'delete',
359 'create',
360 'onlyInThirdController'
361 )
362 );
363 $this->requestBuilder->build();
364 $actualResult = $this->requestBuilder->_get('allowedControllerActions');
365 $this->assertEquals($expectedResult, $actualResult);
366 }
367
368 /**
369 * @test
370 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
371 */
372 public function buildThrowsExceptionIfDefaultControllerCantBeDetermined() {
373 $this->configuration['controllerConfiguration'] = array();
374 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
375 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
376 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
377 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
378 $this->requestBuilder->build();
379 }
380
381 /**
382 * @test
383 */
384 public function buildSetsDefaultControllerIfNoControllerIsSpecified() {
385 $this->injectDependencies();
386 $_GET = array(
387 'tx_myextension_pi1' => array(
388 'foo' => 'bar'
389 )
390 );
391 $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheFirstController');
392 $this->requestBuilder->build();
393 }
394
395 /**
396 * @test
397 */
398 public function buildCorrectlySetsSpecifiedControllerNameIfItsAllowedForTheCurrentPlugin() {
399 $this->injectDependencies();
400 $_GET = array(
401 'tx_myextension_pi1' => array(
402 'controller' => 'TheSecondController'
403 )
404 );
405 $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheSecondController');
406 $this->requestBuilder->build();
407 }
408
409 /**
410 * @test
411 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException
412 */
413 public function buildThrowsInvalidControllerNameExceptionIfSpecifiedControllerIsNotAllowed() {
414 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
415 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
416 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
417 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
418 $_GET = array(
419 'tx_myextension_pi1' => array(
420 'controller' => 'SomeInvalidController'
421 )
422 );
423 $this->requestBuilder->build();
424 }
425
426 /**
427 * @test
428 * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException
429 */
430 public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedControllerIsNotAllowed() {
431 $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
432 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
433 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
434 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
435 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
436 $_GET = array(
437 'tx_myextension_pi1' => array(
438 'controller' => 'SomeInvalidController'
439 )
440 );
441 $this->requestBuilder->build();
442 }
443
444 /**
445 * @test
446 */
447 public function buildSetsDefaultControllerNameIfSpecifiedControllerIsNotAllowedAndCallDefaultActionIfActionCantBeResolvedIsSet() {
448 $this->configuration['mvc']['callDefaultActionIfActionCantBeResolved'] = 1;
449 $this->injectDependencies();
450 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
451 $_GET = array(
452 'tx_myextension_pi1' => array(
453 'controller' => 'SomeInvalidController'
454 )
455 );
456 $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheFirstController');
457 $this->requestBuilder->build();
458 }
459
460 /**
461 * @test
462 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception
463 */
464 public function buildThrowsExceptionIfDefaultActionCantBeDetermined() {
465 $this->configuration['controllerConfiguration'] = array();
466 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
467 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
468 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
469 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
470 $this->requestBuilder->build();
471 }
472
473 /**
474 * @test
475 */
476 public function buildSetsDefaultActionOfTheCurrentControllerIfNoActionIsSpecified() {
477 $this->injectDependencies();
478 $_GET = array(
479 'tx_myextension_pi1' => array(
480 'controller' => 'TheThirdController'
481 )
482 );
483 $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('delete');
484 $this->requestBuilder->build();
485 }
486
487 /**
488 * @test
489 */
490 public function buildCorrectlySetsSpecifiedActionNameForTheDefaultControllerIfItsAllowedForTheCurrentPlugin() {
491 $this->injectDependencies();
492 $_GET = array(
493 'tx_myextension_pi1' => array(
494 'action' => 'create'
495 )
496 );
497 $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('create');
498 $this->requestBuilder->build();
499 }
500
501 /**
502 * @test
503 */
504 public function buildCorrectlySetsSpecifiedActionNameForTheSpecifiedControllerIfItsAllowedForTheCurrentPlugin() {
505 $this->injectDependencies();
506 $_GET = array(
507 'tx_myextension_pi1' => array(
508 'controller' => 'TheThirdController',
509 'action' => 'onlyInThirdController'
510 )
511 );
512 $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('onlyInThirdController');
513 $this->requestBuilder->build();
514 }
515
516 /**
517 * @test
518 * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException
519 */
520 public function buildThrowsInvalidActionNameExceptionIfSpecifiedActionIsNotAllowed() {
521 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
522 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
523 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
524 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
525 $_GET = array(
526 'tx_myextension_pi1' => array(
527 'action' => 'someInvalidAction'
528 )
529 );
530 $this->requestBuilder->build();
531 }
532
533 /**
534 * @test
535 * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException
536 */
537 public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedActionIsNotAllowed() {
538 $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
539 $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
540 $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
541 $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
542 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
543 $_GET = array(
544 'tx_myextension_pi1' => array(
545 'action' => 'someInvalidAction'
546 )
547 );
548 $this->requestBuilder->build();
549 }
550
551 /**
552 * @test
553 */
554 public function buildSetsDefaultActionNameIfSpecifiedActionIsNotAllowedAndCallDefaultActionIfActionCantBeResolvedIsSet() {
555 $this->configuration['mvc']['callDefaultActionIfActionCantBeResolved'] = 1;
556 $this->injectDependencies();
557 $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
558 $_GET = array(
559 'tx_myextension_pi1' => array(
560 'controller' => 'TheThirdController',
561 'action' => 'someInvalidAction'
562 )
563 );
564 $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheThirdController');
565 $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('delete');
566 $this->requestBuilder->build();
567 }
568
569 /**
570 * @test
571 * @see TYPO3\FLOW3\Tests\Unit\Utility\EnvironmentTest
572 */
573 public function untangleFilesArrayTransformsTheFilesSuperglobalIntoAManageableForm() {
574 $convolutedFiles = array(
575 'a0' => array(
576 'name' => array(
577 'a1' => 'a.txt'
578 ),
579 'type' => array(
580 'a1' => 'text/plain'
581 ),
582 'tmp_name' => array(
583 'a1' => '/private/var/tmp/phpbqXsYt'
584 ),
585 'error' => array(
586 'a1' => 0
587 ),
588 'size' => array(
589 'a1' => 100
590 )
591 ),
592 'b0' => array(
593 'name' => array(
594 'b1' => 'b.txt'
595 ),
596 'type' => array(
597 'b1' => 'text/plain'
598 ),
599 'tmp_name' => array(
600 'b1' => '/private/var/tmp/phpvZ6oUD'
601 ),
602 'error' => array(
603 'b1' => 0
604 ),
605 'size' => array(
606 'b1' => 200
607 )
608 ),
609 'c' => array(
610 'name' => 'c.txt',
611 'type' => 'text/plain',
612 'tmp_name' => '/private/var/tmp/phpS9KMNw',
613 'error' => 0,
614 'size' => 300
615 ),
616 'd0' => array(
617 'name' => array(
618 'd1' => array(
619 'd2' => array(
620 'd3' => 'd.txt'
621 )
622 )
623 ),
624 'type' => array(
625 'd1' => array(
626 'd2' => array(
627 'd3' => 'text/plain'
628 )
629 )
630 ),
631 'tmp_name' => array(
632 'd1' => array(
633 'd2' => array(
634 'd3' => '/private/var/tmp/phprR3fax'
635 )
636 )
637 ),
638 'error' => array(
639 'd1' => array(
640 'd2' => array(
641 'd3' => 0
642 )
643 )
644 ),
645 'size' => array(
646 'd1' => array(
647 'd2' => array(
648 'd3' => 400
649 )
650 )
651 )
652 ),
653 'e0' => array(
654 'name' => array(
655 'e1' => array(
656 'e2' => array(
657 0 => 'e_one.txt',
658 1 => 'e_two.txt'
659 )
660 )
661 ),
662 'type' => array(
663 'e1' => array(
664 'e2' => array(
665 0 => 'text/plain',
666 1 => 'text/plain'
667 )
668 )
669 ),
670 'tmp_name' => array(
671 'e1' => array(
672 'e2' => array(
673 0 => '/private/var/tmp/php01fitB',
674 1 => '/private/var/tmp/phpUUB2cv'
675 )
676 )
677 ),
678 'error' => array(
679 'e1' => array(
680 'e2' => array(
681 0 => 0,
682 1 => 0
683 )
684 )
685 ),
686 'size' => array(
687 'e1' => array(
688 'e2' => array(
689 0 => 510,
690 1 => 520
691 )
692 )
693 )
694 )
695 );
696 $untangledFiles = array(
697 'a0' => array(
698 'a1' => array(
699 'name' => 'a.txt',
700 'type' => 'text/plain',
701 'tmp_name' => '/private/var/tmp/phpbqXsYt',
702 'error' => 0,
703 'size' => 100
704 )
705 ),
706 'b0' => array(
707 'b1' => array(
708 'name' => 'b.txt',
709 'type' => 'text/plain',
710 'tmp_name' => '/private/var/tmp/phpvZ6oUD',
711 'error' => 0,
712 'size' => 200
713 )
714 ),
715 'c' => array(
716 'name' => 'c.txt',
717 'type' => 'text/plain',
718 'tmp_name' => '/private/var/tmp/phpS9KMNw',
719 'error' => 0,
720 'size' => 300
721 ),
722 'd0' => array(
723 'd1' => array(
724 'd2' => array(
725 'd3' => array(
726 'name' => 'd.txt',
727 'type' => 'text/plain',
728 'tmp_name' => '/private/var/tmp/phprR3fax',
729 'error' => 0,
730 'size' => 400
731 )
732 )
733 )
734 ),
735 'e0' => array(
736 'e1' => array(
737 'e2' => array(
738 0 => array(
739 'name' => 'e_one.txt',
740 'type' => 'text/plain',
741 'tmp_name' => '/private/var/tmp/php01fitB',
742 'error' => 0,
743 'size' => 510
744 ),
745 1 => array(
746 'name' => 'e_two.txt',
747 'type' => 'text/plain',
748 'tmp_name' => '/private/var/tmp/phpUUB2cv',
749 'error' => 0,
750 'size' => 520
751 )
752 )
753 )
754 )
755 );
756 $requestBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\RequestBuilder', array('dummy'), array(), '', FALSE);
757 $result = $requestBuilder->_call('untangleFilesArray', $convolutedFiles);
758 $this->assertSame($untangledFiles, $result);
759 }
760 }