[TASK] Re-work/simplify copyright header in PHP files - Part 4
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Utility / ResourceUtilityTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Utility;
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 use TYPO3\CMS\Core\Utility\ResourceUtility;
18
19 /**
20 * Testcase for class \TYPO3\CMS\Core\Utility\ResourceUtility
21 */
22 class ResourceUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
23
24 public function recursiveFileListSortingHelperTestDataProvider() {
25 return array(
26 'normal file list' => array(
27 array('fileB', 'fileA', 'someFile'),
28 array('fileA', 'fileB', 'someFile')
29 ),
30 'already in correct order' => array(
31 array('fileA', 'fileB', 'someFile'),
32 array('fileA', 'fileB', 'someFile')
33 ),
34 'hidden file' => array(
35 array('someFile', '.hiddenFile'),
36 array('.hiddenFile', 'someFile')
37 ),
38 'mixed capitalization' => array(
39 array('alllower', 'allCAPS', 'ALLcaps', 'mIxedinanotherway', 'ALLCAPS', 'MiXeDcApItAlIzAtIoN'),
40 array('ALLCAPS', 'ALLcaps', 'allCAPS', 'alllower', 'MiXeDcApItAlIzAtIoN', 'mIxedinanotherway')
41 ),
42 'recursive list with one sublevel' => array(
43 array('fileA', 'fileB', 'anotherDir/someFile', 'someDir/someFile', 'anotherDir/anotherFile'),
44 array('anotherDir/anotherFile', 'anotherDir/someFile', 'someDir/someFile', 'fileA', 'fileB')
45 ),
46 'recursive list with two sub-levels' => array(
47 array('file', 'someDir/someFile', 'someDir/subdir/file', 'someDir/subdir/somefile', 'someDir/anotherDir/somefile', 'anotherDir/someFile'),
48 array('anotherDir/someFile', 'someDir/anotherDir/somefile', 'someDir/subdir/file', 'someDir/subdir/somefile', 'someDir/someFile', 'file')
49 ),
50 'recursive list with three sub-levels' => array(
51 array('someDir/someSubdir/file', 'someDir/someSubdir/someSubsubdir/someFile', 'someDir/someSubdir/someSubsubdir/anotherFile'),
52 array('someDir/someSubdir/someSubsubdir/anotherFile', 'someDir/someSubdir/someSubsubdir/someFile', 'someDir/someSubdir/file')
53 )
54 );
55 }
56
57 /**
58 * @dataProvider recursiveFileListSortingHelperTestDataProvider
59 * @test
60 */
61 public function recursiveFileListSortingHelperCorrectlySorts($unsortedList, $expectedList) {
62 $result = $unsortedList;
63 usort(
64 $result,
65 array('\\TYPO3\\CMS\\Core\\Utility\\ResourceUtility', 'recursiveFileListSortingHelper')
66 );
67
68 $this->assertEquals($expectedList, $result);
69 }
70 }