Merge pull request #11485 from brumsoel/master

Fix timestamp comparator return value
remotes/origin/fix-10825
Lukas Reschke 10 years ago
commit 116a1b366a
  1. 2
      apps/files/lib/helper.php
  2. 4
      apps/files/tests/helper.php

@ -82,7 +82,7 @@ class Helper
public static function compareTimestamp(FileInfo $a, FileInfo $b) { public static function compareTimestamp(FileInfo $a, FileInfo $b) {
$aTime = $a->getMTime(); $aTime = $a->getMTime();
$bTime = $b->getMTime(); $bTime = $b->getMTime();
return $aTime - $bTime; return ($aTime < $bTime) ? -1 : 1;
} }
/** /**

@ -33,10 +33,10 @@ class Test_Files_Helper extends \Test\TestCase {
*/ */
private function getTestFileList() { private function getTestFileList() {
return array( return array(
self::makeFileInfo('a.txt', 4, 1000), self::makeFileInfo('a.txt', 4, 2.3 * pow(10, 9)),
self::makeFileInfo('q.txt', 5, 150), self::makeFileInfo('q.txt', 5, 150),
self::makeFileInfo('subdir2', 87, 128, true), self::makeFileInfo('subdir2', 87, 128, true),
self::makeFileInfo('b.txt', 166, 800), self::makeFileInfo('b.txt', 2.2 * pow(10, 9), 800),
self::makeFileInfo('o.txt', 12, 100), self::makeFileInfo('o.txt', 12, 100),
self::makeFileInfo('subdir', 88, 125, true), self::makeFileInfo('subdir', 88, 125, true),
); );

Loading…
Cancel
Save