[BUGFIX] Followup Fluid Template Fallback paths
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Utility / ArrayUtilityTest.php
index 2f28c2c..ca66af3 100644 (file)
@@ -7,8 +7,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Utility;
  *  (c) Extbase Team
  *  All rights reserved
  *
- *  This class is a backport of the corresponding class of FLOW3.
- *  All credits go to the v5 team.
+ *  This class is a backport of the corresponding class of TYPO3 Flow.
+ *  All credits go to the TYPO3 Flow team.
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
  *  free software; you can redistribute it and/or modify
@@ -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) {
@@ -406,7 +408,63 @@ class ArrayUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $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
+        */
 
-?>
\ No newline at end of file
+       public function sortArrayWithIntegerKeysSortsNumericArrays(array $arrayToSort, array $expectedArray) {
+               $sortedArray = \TYPO3\CMS\Extbase\Utility\ArrayUtility::sortArrayWithIntegerKeys($arrayToSort);
+               $this->assertSame($sortedArray, $expectedArray);
+       }
+}