[BUGFIX] Followup Fluid Template Fallback paths
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Utility / ArrayUtilityTest.php
index 69de2a4..ca66af3 100644 (file)
@@ -377,11 +377,13 @@ class ArrayUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
+        *
         * @param array $inputArray1
         * @param array $inputArray2
         * @param boolean $dontAddNewKeys
         * @param boolean $emptyValuesOverride
         * @param array $expected
+        *
         * @dataProvider arrayMergeRecursiveOverruleData
         */
        public function arrayMergeRecursiveOverruleMergesSimpleArrays(array $inputArray1, array $inputArray2, $dontAddNewKeys, $emptyValuesOverride, array $expected) {
@@ -405,4 +407,64 @@ class ArrayUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $expected = array(1, 0, 3, 0, 5);
                $this->assertSame($expected, \TYPO3\CMS\Extbase\Utility\ArrayUtility::integerExplode(',', $inputString));
        }
+
+       /**
+        * dataProvider for sortArrayWithIntegerKeys
+        *
+        * @return array
+        */
+       public function sortArrayWithIntegerKeysDataProvider() {
+               return array(
+                       array(
+                               array(
+                                       '20' => 'test1',
+                                       '11' => 'test2',
+                                       '16' => 'test3',
+                               ),
+                               array(
+                                       '11' => 'test2',
+                                       '16' => 'test3',
+                                       '20' => 'test1',
+                               )
+                       ),
+                       array(
+                               array(
+                                       '20' => 'test1',
+                                       '16.5' => 'test2',
+                                       '16' => 'test3',
+                               ),
+                               array(
+                                       '20' => 'test1',
+                                       '16.5' => 'test2',
+                                       '16' => 'test3',
+                               )
+                       ),
+                       array(
+                               array(
+                                       '20' => 'test20',
+                                       'somestring' => 'teststring',
+                                       '16' => 'test16',
+                               ),
+                               array(
+                                       '20' => 'test20',
+                                       'somestring' => 'teststring',
+                                       '16' => 'test16',
+                               )
+                       ),
+               );
+       }
+
+       /**
+        * @test
+        *
+        * @param array $arrayToSort
+        * @param array $expectedArray
+        *
+        * @dataProvider sortArrayWithIntegerKeysDataProvider
+        */
+
+       public function sortArrayWithIntegerKeysSortsNumericArrays(array $arrayToSort, array $expectedArray) {
+               $sortedArray = \TYPO3\CMS\Extbase\Utility\ArrayUtility::sortArrayWithIntegerKeys($arrayToSort);
+               $this->assertSame($sortedArray, $expectedArray);
+       }
 }