[TASK] Extend untangleFilesArray function test in RequestBuilder 19/54619/5
authorJoshua Westerheide <dev@jdoubleu.de>
Sat, 11 Nov 2017 16:42:05 +0000 (17:42 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 15 Nov 2017 07:22:26 +0000 (08:22 +0100)
Check for cases where the files array is nested more complex or
keywords (e.g. "error") are used as field names.

Run `curl -F "d0[]=@d12.txt" -F "d0[d1][d2][d3]=@d12.txt"
-F "error=@error_file.txt" localhost:8080` against a custom
php script to generate the testing $_FILES array.

Resolves: #82976
Releases: master, 8.7, 7.6
Change-Id: I51fb9da7c87871b6bb1e8ac4de317973f307dd49
Reviewed-on: https://review.typo3.org/54619
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/extbase/Tests/Unit/Mvc/Web/RequestBuilderTest.php

index 699b5a1..2c5a8f7 100644 (file)
@@ -668,6 +668,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'd0' => [
                 'name' => [
                     'd1' => [
+                        0 => 'd12.txt',
                         'd2' => [
                             'd3' => 'd.txt'
                         ]
@@ -675,6 +676,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
                 'type' => [
                     'd1' => [
+                        0 => 'text/plain',
                         'd2' => [
                             'd3' => 'text/plain'
                         ]
@@ -682,6 +684,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
                 'tmp_name' => [
                     'd1' => [
+                        0 => '/private/var/tmp/phpMf9Qx9',
                         'd2' => [
                             'd3' => '/private/var/tmp/phprR3fax'
                         ]
@@ -689,6 +692,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
                 'error' => [
                     'd1' => [
+                        0 => 0,
                         'd2' => [
                             'd3' => 0
                         ]
@@ -696,6 +700,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 ],
                 'size' => [
                     'd1' => [
+                        0 => 200,
                         'd2' => [
                             'd3' => 400
                         ]
@@ -743,6 +748,13 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                         ]
                     ]
                 ]
+            ],
+            'error' => [
+                'name' => 'error_file.txt',
+                'type' => 'text/plain',
+                'tmp_name' => '/private/var/tmp/phpADDu87fE',
+                'error' => 0,
+                'size' => 120
             ]
         ];
         $untangledFiles = [
@@ -773,6 +785,13 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ],
             'd0' => [
                 'd1' => [
+                    0 => [
+                        'name' => 'd12.txt',
+                        'type' => 'text/plain',
+                        'tmp_name' => '/private/var/tmp/phpMf9Qx9',
+                        'error' => 0,
+                        'size' => 200
+                    ],
                     'd2' => [
                         'd3' => [
                             'name' => 'd.txt',
@@ -803,6 +822,13 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                         ]
                     ]
                 ]
+            ]     ,
+            'error' => [
+                'name' => 'error_file.txt',
+                'type' => 'text/plain',
+                'tmp_name' => '/private/var/tmp/phpADDu87fE',
+                'error' => 0,
+                'size' => 120
             ]
         ];
         $requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::class, ['dummy'], [], '', false);