TYPO3 CMS  TYPO3_6-2
ResourceUtilityTest.php
Go to the documentation of this file.
1 <?php
3 
18 
23 
28  return array(
29  'normal file list' => array(
30  array('fileB', 'fileA', 'someFile'),
31  array('fileA', 'fileB', 'someFile')
32  ),
33  'already in correct order' => array(
34  array('fileA', 'fileB', 'someFile'),
35  array('fileA', 'fileB', 'someFile')
36  ),
37  'hidden file' => array(
38  array('someFile', '.hiddenFile'),
39  array('.hiddenFile', 'someFile')
40  ),
41  'mixed capitalization' => array(
42  array('alllower', 'allCAPS', 'ALLcaps', 'mIxedinanotherway', 'ALLCAPS', 'MiXeDcApItAlIzAtIoN'),
43  array('ALLCAPS', 'ALLcaps', 'allCAPS', 'alllower', 'MiXeDcApItAlIzAtIoN', 'mIxedinanotherway')
44  ),
45  'mixed capitalization reversed' => array(
46  array('MiXeDcApItAlIzAtIoN', 'mIxedinanotherway', 'ALLcaps', 'allCAPS', 'ALLCAPS', 'alllower'),
47  array('ALLCAPS', 'ALLcaps', 'allCAPS', 'alllower', 'MiXeDcApItAlIzAtIoN', 'mIxedinanotherway')
48  ),
49  'recursive list with one sublevel' => array(
50  array('fileA', 'fileB', 'anotherDir/someFile', 'someDir/someFile', 'anotherDir/anotherFile'),
51  array('anotherDir/anotherFile', 'anotherDir/someFile', 'someDir/someFile', 'fileA', 'fileB')
52  ),
53  'recursive list with two sub-levels' => array(
54  array('file', 'someDir/someFile', 'someDir/subdir/file', 'someDir/subdir/somefile', 'someDir/anotherDir/somefile', 'anotherDir/someFile'),
55  array('anotherDir/someFile', 'someDir/anotherDir/somefile', 'someDir/subdir/file', 'someDir/subdir/somefile', 'someDir/someFile', 'file')
56  ),
57  'recursive list with three sub-levels' => array(
58  array('someDir/someSubdir/file', 'someDir/someSubdir/someSubsubdir/someFile', 'someDir/someSubdir/someSubsubdir/anotherFile'),
59  array('someDir/someSubdir/someSubsubdir/anotherFile', 'someDir/someSubdir/someSubsubdir/someFile', 'someDir/someSubdir/file')
60  )
61  );
62  }
63 
70  public function recursiveFileListSortingHelperCorrectlySorts($unsortedList, $expectedList) {
71  $result = $unsortedList;
72  usort(
73  $result,
74  array('\\TYPO3\\CMS\\Core\\Utility\\ResourceUtility', 'recursiveFileListSortingHelper')
75  );
76  $this->assertSame($expectedList, $result);
77  }
78 }
recursiveFileListSortingHelperCorrectlySorts($unsortedList, $expectedList)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.