diff options
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 13 | ||||
-rw-r--r-- | modules/user/user.test | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index d4d14093f..3869a8e7f 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -608,15 +608,14 @@ class DrupalWebTestCase { * 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); } } diff --git a/modules/user/user.test b/modules/user/user.test index 228be6b81..a8abd3ea2 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -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. |