1 file.test FileTestCase::assertSameFile($file1, $file2)

Check that two files are the same by comparing the fid and filepath.

Parameters

$file1: File object to compare.

$file2: File object to compare.

File

core/modules/simpletest/tests/file.test, line 91
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

FileTestCase
Base class for file tests that adds some additional file specific assertions and helper functions.

Code

function assertSameFile($file1, $file2) {
  $this->assertEqual($file1->fid, $file2->fid, format_string('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->fid, '%file2-fid' => $file2->fid)), 'Same file');
  $this->assertEqual($file1->uri, $file2->uri, format_string('Files have the same path: %file1 == %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Same file');
}