function FileTestCase::assertSameFile
Check that two files are the same by comparing the fid and filepath.
Parameters
$file1: File object to compare.
$file2: File object to compare.
2 calls to FileTestCase::assertSameFile()
- FileMoveTest::testExistingReplace in modules/
simpletest/ tests/ file.test - Test replacement when moving onto a file that already exists.
- FileSaveDataTest::testExistingReplace in modules/
simpletest/ tests/ file.test - Test file_save_data() when replacing an existing file.
File
-
modules/
simpletest/ tests/ file.test, line 90
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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.