You are here

protected function DrupalWebTestCase::drupalCompareFiles in SimpleTest 6.2

Same name and namespace in other branches
  1. 7.2 drupal_web_test_case.php \DrupalWebTestCase::drupalCompareFiles()
  2. 7 drupal_web_test_case.php \DrupalWebTestCase::drupalCompareFiles()

Compare two files based on size and file name.

File

./drupal_web_test_case.php, line 1008

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function drupalCompareFiles($file1, $file2) {
  $compare_size = filesize($file1->filename) - filesize($file2->filename);
  if ($compare_size) {

    // Sort by file size.
    return $compare_size;
  }
  else {

    // The files were the same size, so sort alphabetically.
    return strnatcmp($file1->name, $file2->name);
  }
}