Commit 582fbf28 authored by Dries's avatar Dries

- Patch #395228 by c960657: fixed sorting order in drupalGetTestFiles().

parent 6fe3c7c0
......@@ -608,15 +608,14 @@ protected function drupalGetTestFiles($type, $size = NULL) {
* Compare two files based on size and file name.
*/
protected function drupalCompareFiles($file1, $file2) {
// Determine which file is larger.
$compare_size = (filesize($file1->filepath) > filesize($file2->filepath));
if (!$compare_size) {
// Both files were the same size, so return whichever one is alphabetically greater.
return strnatcmp($file1->name, $file2->name);
$compare_size = filesize($file1->filepath) - filesize($file2->filepath);
if ($compare_size) {
// Sort by file size.
return $compare_size;
}
else {
// Return TRUE if $file1 is larger than $file2.
return $compare_size;
// The files were the same size, so sort alphabetically.
return strnatcmp($file1->name, $file2->name);
}
}
......
......@@ -568,7 +568,9 @@ class UserPictureTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$image = current($this->drupalGetTestFiles('image'));
// Images are sorted first by size then by name. We need an image
// bigger than 1 KB so we'll grab the last one.
$image = end($this->drupalGetTestFiles('image'));
$info = image_get_info($image->filepath);
// Set new variables: valid dimensions, invalid filesize.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment