function DrupalWebTestCase::drupalCompareFiles

Compare two files based on size and file name.

File

modules/simpletest/drupal_web_test_case.php, line 1207

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function drupalCompareFiles($file1, $file2) {
    $compare_size = filesize($file1->uri) - filesize($file2->uri);
    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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.